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
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.
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/
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
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.
I agree, seems like we need to patch this up.
[select] Deriving from formwidget instead -- Fixes #5137
[checkboxradio] Deriving from formwidget instead -- Fixes #5137
[slider] Deriving from formwidget instead -- Fixes #5137
OK ... committing to a branch other than master shouldn't close an issue ...
Here's the fiddle with the problem solved - i.e., with jqm compiled from the branch that is currently submitted as a PR #5207.
This looks great @gabrielschulhof.
PRs #5214 and #5216 also deal with this issue. Based on discussion in #5214, #5216 is the best candidate so far, I think.