CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Grid Auto Refresh

Print topic Send  topic

Author Message
mbishop1980

Posts: 31
Posted: 10/15/2009, 11:04 AM

I am wanting to create a chat applications using CCS 4.3.

What I have so far is really not much. I have the record that inserts the record into the chat_messages table.
Then the grid grabs the messages from the chat_messages table and displays them.

What I'm wanting to do is have the grid where it auto refreshes every 2 secs and will post the new messages from the chat_messages table..

I have placed an update panel on the page and put both the grid and the form in the update panel. But I'm not sure where to go from here.

I know this can be done with simple php and AJAX but want to incorporate it into CCS because my intranet is written using CCS.

Any help would be greatly appreciated!!
_________________
Thanks,
Eric
View profile  Send private message
datadoit
Posted: 10/15/2009, 1:39 PM

CCS is an IDE. You incorporate PHP and AJAX and many other languages.
For this, sounds like some javascript is your best bet, or even some
AJAX to post messages and get responses.

Here's a well documented javascript sample:

http://grizzlyweb.com/webmaster/javascripts/refresh.asp
mbishop1980

Posts: 31
Posted: 10/16/2009, 6:16 AM

So I should be able to simply put the code below into page and then for the bodies onLoad put the function and this should refresh it every 2 seconds?

function doLoad()
{
// the timeout value should be the same as in the "refresh" meta-tag
setTimeout( "refresh()", 2*1000 );
}


I will try this and see if it works...Thank you very much...
_________________
Thanks,
Eric
View profile  Send private message
mbishop1980

Posts: 31
Posted: 10/16/2009, 6:33 AM

That worked out great but now we have a problem. It is also refreshing the form where the user types the message every 2 seconds, is there any way I can make it not refresh the form?

If not I understand, I'm doing research myself to see if I can find the answer to this question.
_________________
Thanks,
Eric
View profile  Send private message
datadoit
Posted: 10/16/2009, 7:11 AM

The first thing that comes to my mind on this is to have your chat
history in an iframe. Then you could have auto refresh on the history
iframe only.
whiterabbitwond

Posts: 28
Posted: 10/29/2009, 5:09 PM

Funny, was trying to build something like this earlier this year, and ran into the same issues. This is how I solved it (sort of). Ideally though, it would be better to be able to code an ajax call to refresh data as it is pushed to the client, rather than the client polling. But if i could do that...

Basically i created 2 iframes on the main page. the chat box was to be on the right of the app.
the top iframe, had a page with a update-panel that polled the db every 5 seconds.
the bottom right frame page had just a single box that was in an update-panel.

Pros and cons
issues:
the chat log windows, did not have scroll bars as it was reloading every 5 seconds. the issue being if i allowed scroll bars, it would display the top N records, when we wanted the bottom records (the way most chat clients behave).
when chatting, the sent message did not display instantly. it would display in 0-5 seconds on the next poll in top iframe.

considered prebuilt chat clients like ajax chat, but did not know how to tie them to my db...
at the end of the day, users did not care about having a chat client in my app, they just used what they had always used (gtalk/msn etc)
so it was another lesson in "if it ain't broke, don't fix it" and "FIRST, understand what your users need and want"
cheers
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.