Skip to main content
May 13, 2010
Question

cfdiv form submit... then refresh

  • May 13, 2010
  • 2 replies
  • 2598 views

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.

    This topic has been closed for replies.

    2 replies

    March 22, 2012

    I ended up using jquery.

    ilssac
    Inspiring
    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.

    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?

    ilssac
    Inspiring
    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