[whatwg] Re: several messages

Ian Hickson ian at hixie.ch
Wed Jun 30 16:35:19 PDT 2004


Wow. Ok, I get the message, you all want editable selects back. :-)

I read all your mails, and here's the compromise I think makes most
sense. It is based directly on suggestions made in these threads, so
if it looks familiar, that's why!

If backwards compatibility is not important:

   <p>
    <label>
     Select a breed:
     <input type="text" name="breed" data="breeds">
     <datalist id="breeds">
      <option value="Abyssinian">
      <option value="Alpaca">
      <!-- ... -->
     </datalist>
    </label>
   </p>


If it is:

   <p>
    <label>
     Select a breed:
     <input type="text" name="breed" data="breeds">
    </label>
    <datalist id="breeds">
     <label>
      or select one from the list:
      <select name="breed">
       <option>Abyssinian
       <option>Alpaca
       <!-- ... -->
      </select>
     </label>
    </datalist>
   </p>


Basically, we add a "data" attribute to <input> elements which applies to
the "text", "uri", "email", "number", "range", and date- and time- related
types. This attribute points to a <datalist> or <select> element (or maybe
any element). The list of values that the UA can show as autocomplete
values consists of all the <option> elements inside the <datalist> or
<select> element (as in, getElementsByTagName('option')). If those
elements have "value" attributes, they are used as the value. Otherwise,
the contents of the <option> elements are used.

All the contents of <datalist> elements are hidden on WF2 UAs, and can
thus be used as the fallback rendering for legacy UAs. Controls inside
<datalist> elements are never successful in WF2 UAs. <datalist> doesn't
take any attributes other than the common attributes.

This doesn't address all the problems I raised earlier. In particular, it
is still possible for legacy UAs to end up submitting two values. It has
advantages though, like you can leverage the data="" attribute on the
<select> element:

   <input type="datetime" data="calendar" name="d">
   <datalist id="calendar">
    <select data="calendar.xml"></select>
   </datalist>

Or maybe we can simply allow data="" on the <datalist>:

   <input type="datetime" data="calendar" name="d">
   <datalist id="calendar" data="calendar.xml"></datalist>

What do people think? Did I miss a critical use case?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list