Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfdiv form submit... then refresh

Participant ,
May 13, 2010 May 13, 2010

I love all the fun stuff I can do with cfdiv.  Recently I setup a cfdiv that when called displays a form.  The user can then enter data and save the form all without leaving the "main" page.  I was wondering though... Once that form is submitted is there a way to have the main page determine that there is new data to display, and if yes, display it without refreshing the main page?  Facebook does something like this with their comments.

Any ideas/approaches/thoughts are welcome.

2.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 13, 2010 May 13, 2010

Yes it is possible, but the first thing you have to work out is do you want to push data or pull data from the server?  With push, the server sends data to all clients connected to it whenever new data arrives.  The trouble is that you can't do this with normal HTTP communications becase with normal web browsers and HTTP the client does not stay connected to the server between requests.  So the server has no way to push data to them.

To get push technology you need to move beyond basic browsers and HTTP into something that will stay connected.  Adobe offers the Flash|Flex|Air set of client tools that would allow this.  Other companies offer competing products.

But for basic browser and HTTP communications you can only pull data.  That is the browser makes a new request for data from the server and the server sends it, if there is anything new.  This can easily be done behind the scenes with JavaScript and the xmlHTTPrequest() function, i.e. AJAX.  But you have to think about it in terms of the client asking the server for new data every 5, 15, 30, 60 seconds or some other regular schedule.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 13, 2010 May 13, 2010

I want to do this.. "This can easily be done behind the scenes with JavaScript and the xmlHTTPrequest() function, i.e. AJAX.  But you have to think about it in terms of the client asking the server for new data every 5, 15, 30, 60 seconds or some other regular schedule."

What is the cf tag or function do do what you mentioned?  Tutorial?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 13, 2010 May 13, 2010

It is not a ColdFusion tag or function.

This is client side coding, while ColdFusion does offer some wizard tags to build client side code (<cfform...>,<cfinput...><cfdiv...>).  It does not have one for this.  You will have to create your own AFAIK.

http://www.w3schools.com/xml/xml_http.asp

http://www.w3schools.com/ajax/default.asp

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 13, 2010 May 13, 2010

I was hoping you wouldn't say that. 

I'll start doing some research.

If by any chance someone has done something like this utilizing cf somehow, please do let me know.

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 13, 2010 May 13, 2010

CF will work with AJAX just fine.  It just won't write the JavaScript, HTML and CSS for you.

But there is no reason to be afraid.  Some people get intimated  by the big sounding words.  But the basic building blocks are very simple.  It's just that with most good systems, the simple building blocks can be combined in a multitude of ways to create impressive, sophisticated structures.

And don't be affraid to ask some questions once you have read through the examples.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 13, 2010 May 13, 2010

I ain't scared I'm a gangsta.  What?  No seriously though I'll figure it out I was just hoping there was something ready to go for me in CF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2012 Mar 21, 2012
LATEST

I ended up using jquery.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources