views:

73

answers:

2

We have all seen countless instances of forms with a select drop down having one of it's options as "Other" and on choosing that option, we get to see a input text box (which was hidden all along) asking us to type in our input.

Is there a better way to implement this? Are there plugins out there which will let me do this better? Or are standard HTML elements suffice (some setting to a , may be) ?

+1  A: 

An editable combobox might be a good alternative. The challenge is to style it in such a way that it is clear to the user that he can actually edit the contents of the control, rather than only selecting the provided default contents.

Daan
I dont want the user to edit the options available in the dropdown.
Vijay Dev
That's not what I mean by 'editable combobox'. The control does show a dropdown with options, like a regular combobox, but in the topmost part, next to the 'dropdown-arrow', the user can fill in a custom value.
Daan
can you explain with an example?
Vijay Dev
Here is an example of what I mean in Flash: http://polygeek.com/512_flex_getting-user-typed-input-from-and-editable-combobox Here is another example using javascript: http://dhtmlx.com/docs/products/dhtmlxCombo/
Daan
thanks! The one in polygeek looks good for me. Will try that.
Vijay Dev
A: 

That's a fairly common way to design a form both on paper and on the web. I'm not quite sure exactly what you mean with a better way to do so...

If you're worried about the hidden field not appearing if the user has javascript disabled, I'll suggest you hide the field using javascript or have a duplicate "If other please specify" text area in a noscript block:

<select><!-- implemented something like rahul showed  -->
<noscript>
   <label for="ifOtherInput">If other please specify</label>
   <input type="text" name="ifOtherInput" id="ifOtherInput">
</noscript>
<!-- This is initially hidden and shown by when the user selects the other option -->
<div id="divOther" class="dispnone">
    <!-- Here we know the user selected other so we can just have this label: -->
    <label for="ifOtherInputJs">Please specify</label> 
   <input type="text" name="ifOtherInputJs" id="ifOtherInputJs">
</div>

The backend must handle that the input in the noscript block may be missing. Or you could add the javascript version of the input to the page of the input using javascript (so both cannot possibly appear simultaniously so that they can have the same name.

Stein G. Strindhaug