-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to set a specific value sent to the server for each option AND fire 'change' #195
base: master
Are you sure you want to change the base?
Conversation
At the moment, if you have a dropdown menu like this: <paper-dropdown-menu name="country" id="country" label="Your country"> <paper-listbox attr-for-selected="choice" selected="[[countryDefault]]" class="dropdown-content"> <paper-item choice="it">Italy</paper-item> <paper-item choice="fr">France</paper-item> <paper-item choice="">Other</paper-item> </paper-listbox> </paper-dropdown-menu> After submitting, the server will receive "Italy", "France" or "". There is no way, at the moment, for it to behave like a native select box: <select> <option value="it">Italy</option> <option value="fr">France</option> <option value="">Other</option> </select> The only option to send the right data to the server is by setting the "label" attribute for the various <paper-items> elements. However, this has the side effect that after making the selection, the user will see "it", "fr" etc. This patch addresses that: if `value` is set for the selected item, THAT is the value considered and assigned to the paper-dropdown-menu. I wouldn't have tortured you with a PR if I had found a way to do this in other ways... sorry!
Just so that you know how desperate I am for this patch, this is what I am in my main app :D
|
I just broadened the scope of this PR a little. I noticed that 4 tests fail with this latest change. Maybe it's me doing something stupid; I can't figure out why they would though. |
…ction. Important so that labels and values can be ''
At the moment, if you have a dropdown menu like this:
After submitting, the server will receive "Italy", "France" or "". There is no way, at the moment, for it to behave like a native select box:
The only option to send the right data to the server is by setting the "label" attribute for the various elements. However, this has the side effect that after making the selection, the user will see "it", "fr" etc.
This patch addresses that: if
value
is set for the selected item, THAT is the value considered and assigned to the paper-dropdown-menu.I wouldn't have tortured you with a PR if I had found a way to do this in other ways... sorry!