I have a form that includes a select field using https://docs.atlassian.com/aui/latest/docs/single-select.html. That field is pre-populated with the current value, and if I don't change it, posting the form works fine -- that field's value is posted. However, if I switch to a different option, the field does NOT post with the form, and I can't figure out why.
Here's the relevant snippet:
<div> <label for="data-selector">Form Label</label> <aui-select id="data-selector" name="data-field" src="getOptionsList.php"> <aui-option selected value="$currentValue">$currentName</aui-option> </aui-select> </div>
And here's a snippet of what that generates in the source of the page:
<input type="text" class="text" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" id="data-selector" aria-controls="aui-uid-0" aria-activedescendant="null"> <select name="data-field"> <option selected="true" value="14980">Name</option> </select>
If I submit the form right now, the data posted would include {"data-field": "14980"}
After selecting a different option, however, here's what the source looks like:
<input type="text" class="text aui-alignment-target aui-alignment-abutted aui-alignment-abutted-left aui-alignment-element-attached-top aui-alignment-element-attached-left aui-alignment-target-attached-bottom aui-alignment-target-attached-left" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" id="data-selector" aria-controls="aui-uid-0" aria-activedescendant="null" aria-busy="false"> <select name="data-field"> <option selected="true" value="15083">NewName</option> </select>
I'd therefore expect, when I submit the form, the data posted to include {"data-field": "15083"}. But it doesn't. I've made the submit button do nothing but console.log the form data, and it's clear: for some reason, changing the value of that select form removes it from the data
Here's a screenshot of the console demonstrating that, for some reason, there's one fewer object in the form data after I change the value of that select: http://i.stack.imgur.com/gupvR.png
Help!
Community moderators have prevented the ability to post new answers.
Sorry, I'm not quite sure what you're asking for. Can you elaborate? That first snippet is how the field is populated, unless you're asking to see getOptionsList.php? I really don't think that's the issue -- as you can see, the appropriate options do get to the source of the page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for the slow response -- apparently I'm rate-limited to 1 comment or post per day as a new user with no reputation. Yes, this is the only select with that name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is it the only select with the name data-field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do, and that part works fine. (I truncated that part of the code in the snippet above.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Who populates $currentValue and $currentName?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.