News for hackers. Stuff that matters.
Re:HTML Data List Element by cmg on Wednesday June 23, 2021 @11:21AM (#27605557)
With select you have <option value="123">Customer Name</option> so the user sees Customer Name but submitting the form gets 123. With datalist you only have <option value="Customer Name"/> and the input tied to it gets Customer Name.
Re:HTML Data List Element by recursive on Wednesday June 23, 2021 @01:18PM (#27607117)
Yes. If you want to have the id, then why are you using a text input in the first place? This seems to be exactly the use case for a <select>.
Re:HTML Data List Element by cmg on Wednesday June 23, 2021 @08:18PM (#27612322)
For me, datalist is almost an acceptable compromise for a typical combobox (input + select/dropdown) control. Custom solutions for that require JS and are not accessible or otherwise don't behave as a user would expect a standard input to without lots of extra work.