[whatwg] Re: Web Forms 2: Altenative to <select editable>

On Wed, 23 Jun 2004 17:50:15 +0100, Malcolm Rowe  
<malcolm-what at farside.org.uk> wrote:

> Just for the record, what I eventually ended up suggesting was something  
> you didn't mention. It worked out to something like this:    <input  
> type="email" name="test" data="...">
>     <option>foo</option>
>     <option>bar</option>
>    </input>

Ideally we would want something that is an combo box for WF2 browsers,  
functionally a combo box for JS-capable browsers, and a text input box for  
the rest. At Hiveminds [1] I saw an intriguing solution using an 'input'  
plus an 'ul' unordered list for the options. Without JS you got an 'input'  
box, with JS you should get something that behaves much like a combo box.  
If you haven't got either JS or CSS you would see a spurious 'ul' list of  
options, which would be annoying but not destructive. It wouldn't be  
forward compatible to the WF2 draft as it uses 'input', not 'select'.


Adding options to 'input' is not such an outrageous idea. To take a detour  
to VoiceXML (a speech markup language) [2]. VoiceXML has 'field' elements  
that are analogous to 'input', or maybe rather 'select', with behaviours  
attached to it. Since voice has to contend with natural language, it uses  
grammars that be anything from a list of options to something like  
"$action $object" to extensive DWIM style grammars. You would like to  
reuse grammars, but sometimes they are missing options that you would want  
to use.

Say you have a grammar of known fruits with relative URL <fruits.grammar>,  
but that grammar doesn't have "slime mold" among its options. All you need  
to do is add it into the 'field' itself:

<field name="example">
   <grammar src="fruits.grammar"/>
   <option>Slime mold</option>
   <prompt>What is your favourite fruit?</prompt>
   <nomatch>That's not a fruit!</nomatch>
</field>

Equivalently, we could have additive options in 'input',
<input type="email" name="private.mail.address">
   <option>None of your business</option>
</input>

This 'input' would either return a valid email address or the string "None  
of your business". Of course the server would have to handle the latter  
case as well as email addresses, but if it couldn't the author shouldn't  
had added the 'option' in the first place.

[1] <http://hiveminds.info/phpBB/viewtopic.php?p=36242#36242>
[2] <http://www.w3.org/TR/voicexml20/>

-- 
Jonny Axelsson,
Web standards,
Opera Software

Received on Thursday, 24 June 2004 02:06:51 UTC