Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#8917 closed enhancement (fixed)

FilteringSelect: If required="false", set custom valid DefaultValue

Reported by: thekryz Owned by:
Priority: high Milestone: 1.5
Component: Dijit - Form Version: 1.2.3
Keywords: FilteringSelect displayedvalue validation Cc:
Blocked By: Blocking:


At the moment (since [13989]) with a FilteringSelect? and required="false", it is okay to leave the FilteringSelect? blank and it will be accepted when submitting a form. My suggestion is, that a user can enter a custom Default Value (other than the atm hard-coded "") for the FilteringSelect?.

My reason for this: I am using FilteringSelects? in my form, that display a default value using displayedvalue like this:

<select dojotype="dijit.form.FilteringSelect"
        displayedvalue="Please choose"
        required="false" name="myName">
    <option value="#LOW">Low</option>
    <option value="#HIGH">High</option>

Now I have some FilteringSelects? on the page that are required, but this one is not supposed to be. I'd therefor like my displayedvalue to be "valid" in the sense that the FilteringSelect? returns no value, but doesn't show me that it's invalid and can send the form.

This is also about a better handling of Default Values in FilteringSelects? - maybe the two issues can have one solution?

Change History (5)

comment:1 Changed 13 years ago by thekryz

I did my own custom widget for now like this:

    [ dijit.form.FilteringSelect ],
            return this._isvalid || (!this.required && this.getDisplayedValue() == this.defaultValue);
        getValue: function(	/* item */ item, 
                            /* attribute-name-string */ attribute, 
                            /* value? */ defaultValue){
            var value = (attribute == "value") ? item.value : (item.innerText || item.textContent || '');
            /* Check if value is DefaultValue, if yes - return "" */
            if(value == defaultValue){
                value = "";
            return value;


There, you can enter an defaultValue instead of having to go with "" as a valid default.

comment:2 Changed 12 years ago by Douglas Hays

Milestone: 1.4future

comment:3 Changed 12 years ago by haysmark

Resolution: fixed
Status: newclosed

We now have the placeHolder attribute on all TextBox? widgets that does exactly this.

comment:4 Changed 12 years ago by Douglas Hays

Milestone: future1.5

comment:5 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.