1 modules.datalist
Florian Bouillon edited this page 2 months ago

Datalist Input

Example

<input name="listing" list="list" data-strict/>
<datalist id="list">
    <option data-value="value submitted" value="shown value">value subtitle</option>
    <option data-value="value submitted" value="shown valuee">value subtitle</option>
    <option data-value="value submitted" value="shown valueq">value subtitle</option>
    <option data-value="value submitted" value="shown valuea">value subtitle</option>
</datalist>

Explications

The new datalist input implement two new things:

  1. a data-value on the options Actually the value attribute is the one shown to the user.
    to make it better for our datas the new data submitted will be the data-value attribute.
    ATTENTION if multiple option have the same value attribute the submitted value will be the first one

  2. a data-strict attribute if the content in the input is something different from all the value attributes it will fail the verifiction if data-strict is set