Ticket #5974 (reopened defect)
[patch] FilteringSelect: don't require a blank entry in the drop down list
| Reported by: | bill | Owned by: | haysmark |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | Dijit | Version: | 1.0 |
| Severity: | normal | Keywords: | |
| Cc: | paulprince |
Description (last modified by haysmark) (diff)
Non-required <select> inputs in a native HTML form typically have a blank option in the drop down, to indicate that no value is specified. (See for example the Milestone field when filing a new ticket in trac.) Currently the only way for a developer to implement a non-required FilteringSelect field is to do the same thing, to have a blank option in the drop down.
However, since FilteringSelect (which has the same UI as ComboBox) appears to the user more like an <input> than a <select>, the user expects to be able to clear the value just by backspacing over the data in the <input>, and doesn't expect to see a blank value in the drop down list. It's also troublesome to have a blank item in your data store.
Eliminate requirement that optional FilteringSelect fields have a blank entry in the drop down. Modify FilteringSelect so that clearing the <input> (by backspacing) makes getValue() return null or undefined (like a blank DateTextBox). Support required parameter for FilteringSelect just like ValidationTextBox... default would be required=true but developer can override. If required=false then a blank input is not flagged as invalid.
setValue(null) (or maybe undefined) would clear the value, same as DateTextBox.
I remember some argument before about supporting a blank key as a valid hidden value for a filtering select, ie:
<select dojoType="dijit.form.FilteringSelect>
<option value="">red</option>
<option value="blue">blue</option>
</select>
However, I consider this a corner case not worth supporting.
Ping me on #dojo if this doesn't make sense.