Skip to content
This repository

Resetting a form doesn't update the select widget value #5137

Closed
mcgrew opened this Issue October 05, 2012 · 8 comments

5 participants

Thomas McGrew Gabriel "_|Nix|_" Schulhof Jasper de Groot fabylv Todd Parker
Thomas McGrew

When creating a form with a select menu and a reset button, resetting the form doesn't update the value in the select widget.

Test page: http://tjmcgrew.com/jquery-select-test.html

To reproduce:
1. Click the "What's the value?" button. The alert box will display 'Banana'.
2. Change the value in the select box (top), e.g. to 'Apple'.
3. Click the "What's the value?" button. The alert box will display 'Apple'.
4. Click the 'Reset form' button. The value in the select widget does not change.
5. Click the "What's the value?" button. The alert box will display 'Banana', which is now the selected value in the <select> element, but not the displayed value.

Jasper de Groot
Owner

@mcgrew

Thanks for reporting the issue.

I created a test page that include all form elements, because this is not only a problem with the select widget but also with the checkboxradio and slider widget: http://jsfiddle.net/FFP85/2/show/

fabylv

this is bug in jquery mobile. it works fine in the native state of data-role="none".
the text needs to be changed in .ui-select .ui-btn-text span
http://jsbin.com/uzaret/37/edit

Gabriel "_|Nix|_" Schulhof
Collaborator

Wow! Looking at @uGoMobi's demo, it looks like the text inputs are about the only ones that work on reset! Insane! I suggest we introduce a root class for all form widgets which listens to the reset signal of the form and calls refresh by default.

Todd Parker

I agree, seems like we need to patch this up.

Gabriel "_|Nix|_" Schulhof gabrielschulhof closed this in b00265d October 22, 2012
Gabriel "_|Nix|_" Schulhof gabrielschulhof reopened this October 22, 2012
Gabriel "_|Nix|_" Schulhof
Collaborator

OK ... committing to a branch other than master shouldn't close an issue ...

Gabriel "_|Nix|_" Schulhof
Collaborator

Here's the fiddle with the problem solved - i.e., with jqm compiled from the branch that is currently submitted as a PR #5207.

Todd Parker

This looks great @gabrielschulhof.

Gabriel "_|Nix|_" Schulhof
Collaborator

PRs #5214 and #5216 also deal with this issue. Based on discussion in #5214, #5216 is the best candidate so far, I think.

Gabriel "_|Nix|_" Schulhof gabrielschulhof closed this in 010ec24 October 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.