From fb1c8bee81eadbf0b16b05c087c415825606b5b7 Mon Sep 17 00:00:00 2001 From: toddparker Date: Thu, 8 Sep 2011 10:58:23 -0400 Subject: [PATCH 1/3] Added a non-adax form submit example. Improved the styling of the forms and confirmation pages. --- docs/forms/forms-sample-response.php | 7 ++++-- docs/forms/forms-sample.html | 35 +++++++++++++++++++++------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/docs/forms/forms-sample-response.php b/docs/forms/forms-sample-response.php index fe0e7224..dfbdbe0c 100755 --- a/docs/forms/forms-sample-response.php +++ b/docs/forms/forms-sample-response.php @@ -27,12 +27,15 @@

You Chose:

- +
" . $_REQUEST['shipping'] . "

"; ?> - + +
+ + Change shipping method diff --git a/docs/forms/forms-sample.html b/docs/forms/forms-sample.html index fee85b17..ce964e87 100755 --- a/docs/forms/forms-sample.html +++ b/docs/forms/forms-sample.html @@ -27,17 +27,14 @@

In jQuery Mobile, form submissions are automatically handled using Ajax whenever possible, creating a smooth transition between the form and the result page. To ensure your form submits as intended, be sure to specify action and method properties on your form element. When unspecified, the method will default to get, and the action will default to the current page's relative path (found via $.mobile.path.get()

Forms also accept attributes for transitions just like anchors, such as data-transition="pop" and data-direction="reverse". To submit a form without Ajax, you can either disable Ajax form handling globally, or per form via the data-ajax="false" attribute. The target attribute (as in target="_blank") is respected on forms as well, and will default to the browser's handling of that target when the form submits. Note that unlike anchors, the rel attribute is not allowed on forms.

- -

Non-Ajax handling

- -

To prevent form submissions from being automatically handled with Ajax, add the data-ajax="false" attribute to the form element. You can also turn of Ajax form handling completely via the ajaxEnabled global config option.

+ -

Simple Ajax form example

-

This page demonstrates automated ajax handling of form submissions. The form below is configured to send regular a get request to forms-sample-response.php. On submit, jQuery Mobile will make sure that the Url specified is able to be retrieved via Ajax, and handle it appropriately. Keep in mind that just like ordinary HTTP form submissions, jQuery Mobile allows get result pages to be bookmarked by updating the Url hash when the response returns successfully. Also like ordinary form submissions, post requests do not contain query parameters in the hash, so they are not bookmarkable.

-
+

Default Ajax form example

+

This demonstrates automated ajax handling of form submissions. The form below is configured to send regular a get request to forms-sample-response.php. On submit, jQuery Mobile will make sure that the Url specified is able to be retrieved via Ajax, and handle it appropriately. Keep in mind that just like ordinary HTTP form submissions, jQuery Mobile allows get result pages to be bookmarked by updating the Url hash when the response returns successfully. Also like ordinary form submissions, post requests do not contain query parameters in the hash, so they are not bookmarkable.

+
- +
- + +
+
+ +

Non-Ajax form example

+ +

To prevent form submissions from being automatically handled with Ajax, add the data-ajax="false" attribute to the form element. You can also turn of Ajax form handling completely via the ajaxEnabled global config option.

+ +

The form below is identical to the one above except for the addition of the data-ajax="false" attribute attribute. When the submit button is pressed, it will result in a full page refresh.

+
+
+
+ + +
+
From 557da74be039efbe9cbf78d0fd1d9d3a72bd4cae Mon Sep 17 00:00:00 2001 From: toddparker Date: Thu, 8 Sep 2011 11:30:42 -0400 Subject: [PATCH 2/3] Fixed typo in button state active default docs. Closes #2403. Thanks jasonrsavino! --- docs/api/globalconfig.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/globalconfig.html b/docs/api/globalconfig.html index e09fcbbe..6c3bbab8 100755 --- a/docs/api/globalconfig.html +++ b/docs/api/globalconfig.html @@ -92,7 +92,7 @@ $(document).bind("mobileinit", function(){
The class assigned to page currently in view, and during transitions
-
activeBtnClass string, default: "ui-page-active"
+
activeBtnClass string, default: "ui-btn-active"
The class used for "active" button state, from CSS framework.
ajaxEnabled boolean, default: true
From 7be8311d4e6a848ccef67348afd5fc48e10a12f3 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Thu, 8 Sep 2011 11:58:55 -0400 Subject: [PATCH 3/3] added location.search to the original page data-url --- js/jquery.mobile.init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.mobile.init.js b/js/jquery.mobile.init.js index 9cd3cf87..3a49efdc 100644 --- a/js/jquery.mobile.init.js +++ b/js/jquery.mobile.init.js @@ -85,7 +85,7 @@ // unless the data url is already set set it to the pathname if ( !$this.jqmData("url") ) { - $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname ); + $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search ); } });