Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
mcgrew opened this Issue · 8 comments

5 participants

@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.

@jaspermdegroot
Collaborator

@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

@gabrielschulhof
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.

@toddparker

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

@gabrielschulhof
Collaborator

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

@gabrielschulhof
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.

@toddparker

This looks great @gabrielschulhof.

@gabrielschulhof
Collaborator

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

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.