Forms submitting first field twice if no initial value defined #5590

Closed
jamiepk opened this Issue Feb 5, 2013 · 6 comments

3 participants

@jamiepk

Tested 1.3.0 RC1 today and noticed all my forms submitting the initial text field twice (one with a value, and one without) if there is no populated "value" attribute on the field.

If I add a value="blah" to the field, the issue goes away.

OUTPUT
[{"name": "lastname", "value": ""},
{"name": "lastname", "value": "Smith"},
{"name": "firstname", "value": "John"}]

EXPECTED OUTPUT
[{"name": "lastname", "value": "Smith"},
{"name": "firstname", "value": "John"}]

Tested in Chrome/Mobile Safari
http://jsbin.com/onibuc/178/edit

@gabrielschulhof

I bet you were clicking into the input field with your mouse when typing in the value. jQM is generating superfluous hidden inputs (#5593).

@gabrielschulhof

If you fill out the input fields using the keyboard only, by pressing Tab, and then typing, and pressing enter when the submit button has the focus, the behaviour is correct.

@gabrielschulhof gabrielschulhof added a commit that referenced this issue Feb 6, 2013
@gabrielschulhof gabrielschulhof Navigation: Append value of named button to form data if the form was…
… submitted by a click of that button without resorting to a hidden input. Fixes #5593 and #5590.
ae3484b
@gabrielschulhof

Please verify that this is fixed in the latest master.

@jwatkin

This seems to have fixed the issue for me, using:

<link href="http://code.jquery.com/mobile/latest/jquery.mobile.css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>

Thank you.

Jim

@jamiepk

Also confirmed this is fixed for me using latest. Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment