House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  JQuery

Not quite sure how jQMobile processes forms

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rick Faircloth
06/20/2011 03:29 PM

I've been using jQuery to process forms via AJAX for a couple of years without problem. I've been working on some tutorials for jQuery Mobile and I'm a little confused about how it handles form processing. The tutorials and even docs are a little sketchy...at least I'm not finding what I need. Anyway, I read that jQuery Mobile "automatically" intercepts the form submissions and processes them via AJAX.  I'm used to having to write the interrupt routine, parse the form variables, and submit the form via $.ajax. So I'm not sure how much, if any, jQuery I need to write to process form via AJAX. Some examples I've seen have the typical intercept, validation, and AJAX processing of form variables, but those are the more advanced uses. At the most basic level, what jQuery and CF would be need to process a form? Rick

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
06/20/2011 09:22 PM

If you want  to do ... "something" with your forms before the data is sent, then yes, do the traditional intercept. If you just want a normal form post though, then jqm will convert it into Ajax and handle displaying the result in the current page. So visually it looks pretty similar, but it's not doing a full page reload. Does that make sense? ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rick Faircloth
06/20/2011 10:23 PM

Yes, thanks for the clarification, Ray. I think for those of us who have been writing our own jQuery AJAX routines for several years, it's difficult to just accept that jQuery Mobile "automatically" handles the AJAX work, without knowing *exactly* what it's doing and what it's not. I guess the platform just needs more time to mature and time for these usage questions to be fleshed out. If you want  to do ... "something" with your forms before the data is sent, then yes, do the traditional intercept. If you just want a normal form post though, then jqm will convert it into Ajax and handle displaying the result in the current page. So visually it looks pretty similar, but it's not doing a full page reload. Does that make sense? ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rick Faircloth
06/20/2011 10:25 PM

I did unexpectantly notice that my data was being inserted into the database, even with the jQuery error and a "loading" dialog that never would go away. I've just got to figure out what the problem is.  I'll be doing server- and client-side validation on any forms, so I guess I might as well write out the full AJAX functionality with a CFC on the backend for processing. Rick If you want  to do ... "something" with your forms before the data is sent, then yes, do the traditional intercept. If you just want a normal form post though, then jqm will convert it into Ajax and handle displaying the result in the current page. So visually it looks pretty similar, but it's not doing a full page reload. Does that make sense? ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
06/20/2011 10:31 PM

I think you may - in your form response - to ensure you output the right "page" divs. Ie, just like you do for normal pages. ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Rick Faircloth
06/21/2011 12:12 PM

Just some follow-up thoughts, Ray. After re-reading another tutorial on AJAX submission in jQuery Mobile, it appears that if anything, such as validation, is going to be involved in the form submission process, then the regular jQuery, non-mobile, intercept and processing has to be performed. The only difference in the mobile version seems to be that the various "pages" (data-role="page") have to be manipulated during the AJAX processing (hidden, show, etc.). This is no different than what I typically do with a non-mobile page when performing jQuery AJAX submissions.  During that process, I put up a window overlay to prevent interaction with the submitted page, then hide and show various dialogs during the processing, error, completion, etc., phases of the process. In jQuery mobile, instead of working with various dialogs during the AJAX process, the "pages" in a jQuery mobile page structure are hidden or shown as appropriate.  The "in-line pages" take the place of my usual processing, error, and success dialogs. This seems to be the only difference in handling the AJAX process. Everything else, including the backend CFC's and methods are the same. Does this seem to be accurate to you? Thanks for your thoughts. Rick PS - I still don't quite understand what an "automated" jQuery Mobile AJAX process is supposed to do....how that differs from the functionality described above. If a form is submitted, allowing jQuery Mobile to "automatically" handle the form submission process, is the "processing" dialog supposed to disappear and show one of the "in-line pages" on a jQuery mobile structured page? I guess need to understand what the "automated AJAX" process is supposed to look like when it's running. Do you see my disconnect? Rick I think you may - in your form response - to ensure you output the right "page" divs. Ie, just like you do for normal pages. ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search jquery

May 23, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference