I use the <input type='text'> <datalist> along with <datalist> to provide name names for the form. Everything works as expected, and my entire user appears.
However, when the user submits the form, I would like to select the right user in my input-based data store. Unfortunately, the names are not unique, and there is a possibility of duplication. To avoid this, all my users have a unique identifier, which is also part of the <datalist> <options> tags.
Is there a way to read anything else besides the meaning of the input text? Is there a link to the selected data item? Can I get a user ID based on text input?
<input type="text" class="form-control" name="userName" placeholder="Type a user name" value="" list="user-datalist" required autofocus> <datalist id="user-datalist"> <option id="53c911ea609252c600632dfe" value="Mr Smith">Mr Smith</option> <option id="53c911ea60925sdfs4e444eg" value="John Snow">John Snow</option> <option id="53c911ea6034534535k345th" value="John Snow">John Snow</option> <option id="53c911ea60925234234234er" value="Mickey Mouse">Mickey Mouse</option> </datalist>
javascript jquery html html5
Tom
source share