jquery-archive / jquery-mobile

jQuery Mobile Framework
https://jquerymobile.com
Other
9.7k stars 2.41k forks source link

#foo anchor on multi-page breaks form submission #1270

Closed phillpafford closed 13 years ago

phillpafford commented 13 years ago

Using this example to submit form data ( http://jquerymobile.com/demos/1.0a3/#docs/forms/../../docs/forms/../../docs/forms/../../docs/forms/../../docs/forms/forms-sample.html ) when using an anchor tag with a specific page hash tag as suggested for a multi-page setup here ( http://jquerymobile.com/demos/1.0a3/docs/pages/multipage-template.html#foo )

The appended #foo breaks the form submission, here is an NON working example: http://jsfiddle.net/Zc9vK/1/ but you should be able to test this.

The problem is it appends the #foo to the end of the URL on submission and when the user navigates back to #foo from #bar

toddparker commented 13 years ago

Issue #952 talks about supporting rel="external" for forms that might help in this case since your action points to a page that isn't local. If you think this is a duplicate, feel free to close this and copy over your message above because the JSFiddle test page is great. Thanks!

phillpafford commented 13 years ago

I think my issue is a little different as this is a form submission. I have tried adding the rel="external" to the button, form and page but still no luck. I'm using the ajax style form submission that JQM adds. I'm also using a multi-page layout so I need the hash tags to navigate to the other pages

phillpafford commented 13 years ago

ok so after taking another look at the JQM documentation I found something that worked. Instead of using this: Home I can use this: Home on the called page: https://github.com/jriggins/jquery-mobile/blob/c910f4b01fcd88acf5ea3794233f2f6d6a8c18ce/docs/forms/forms-sample-response.php So in the JQM Example on how to submit a form, there is not an example of a multi-page layout using the #page-name anchors. By adding the data-rel="back" instead of the #page-name I got the desired results.

Thanks, --Phill

phillpafford commented 13 years ago

LOL the anchor tags above are:

href="#home" rel="back"