Opened 10 years ago

Closed 10 years ago

#14409 closed defect (invalid)

FilteringSelect: required=true considers value="" valid

Reported by: jond Owned by: Douglas Hays
Priority: high Milestone:
Component: Dijit - Form Version: 1.7.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

This is my first bug report, I apologize if its improper. Im using svn trunk.

So basically, If i use required:true the FilteringSelect? does not consider value="" as an invalid option. Example.

<select id="foo" data-dojo-type="dijit.form.FilteringSelect" data-dojo-props="required:true">
<option value="">-Please Select-</option>
<option value="valid">valid option</option>

Examination of the isValid() function reveals.

return this.item || (!this.required && this.get('displayedValue') == ""); // #5974

this.item is an object --> Object { name="-Please Select-", id="", value=""}

Since it is likely that this.item will always be an object of that nature... wouldn't this function always return true?

Is this correct? Or am I suppose to override isValid()?

Change History (4)

comment:1 Changed 10 years ago by bill

Component: GeneralDijit - Form
Description: modified (diff)
Owner: set to Douglas Hays
Summary: Possible bug in FilteringSelect.FilteringSelect: required=true does not consider value="" valid

Huh, isn't that the whole point of required:true flag?

Notes on bug system:

  • fill in proper component
  • try to make summary descriptive
  • use triple curly braces to bracket code examples
  • attach test case using the attach file button


comment:2 Changed 10 years ago by jond

My title is incorrect. it should be. FilteringSelect: required=true considers value="" valid.

Thank you for the formatting help.

Last edited 10 years ago by jond (previous) (diff)

comment:3 Changed 10 years ago by bill

Summary: FilteringSelect: required=true does not consider value="" validFilteringSelect: required=true considers value="" valid

comment:4 Changed 10 years ago by Douglas Hays

Resolution: invalid
Status: newclosed

The FilteringSelect? has a valid value="" with displayed value="Please Select". Since it is user selectable, then it's valid. You probably meant:

<select id="bar" data-dojo-type="dijit.form.FilteringSelect" data-dojo-props="required:true" placeHolder="Please Select" value="">
<option value="valid">valid option</option>
<option value="valid2">valid option 2</option>

If this isn't what you meant, then you will need a custom isValid method.

Note: See TracTickets for help on using tickets.