|
Mailing Lists
|
Home /
Groups /
JQuery
Not quite sure how jQMobile processes forms
I've been using jQuery to process forms via AJAXRick Faircloth 06/20/11 03:29 P If you want to do ... "something" with your forms before the data isRaymond Camden 06/20/11 09:22 P Yes, thanks for the clarification, Ray.Rick Faircloth 06/20/11 10:23 P I did unexpectantly notice that my data was being inserted intoRick Faircloth 06/20/11 10:25 P I think you may - in your form response - to ensure you output theRaymond Camden 06/20/11 10:31 P Just some follow-up thoughts, Ray.Rick Faircloth 06/21/11 12:12 P 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 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 ----- 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 ----- 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 ----- 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 ----- 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 -----
|
May 23, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||