Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11630 closed defect (invalid)

FilteringSelect SetValue() - Shows Invalid Icon But Valid Item Remains

Reported by: mark007 Owned by: anonymous
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.5
Keywords: Cc: Douglas Hays
Blocked By: Blocking:

Description (last modified by bill)


I have found a niggle with FilteringSelect that has effected many of my web tools. I have some dijit FilteringSelect's with a set range of options.

When I set the value using


with "valid" being a valid item, all is fine, but if I then use


with "invalid" not being a valid item, I get the yellow warning icon inside of the FilteringSelect indicating the value is not valid BUT the old "valid" value still remains. This shouldn't be the case. I would expect the invalid value to appear in the FilteringSelect and show the invalid icon.

Test Case Attached.

Attachments (1) (739 bytes) - added by mark007 11 years ago.

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by mark007

Attachment: added

comment:1 Changed 11 years ago by bill

Component: GeneralDijit
Description: modified (diff)
Resolution: invalid
Status: newclosed

It can't work that way because FilteringSelect has a mapping betweeen value and displayed value. For example, in a FilteringSelect for U.S. state, you do

dijit.byId("filtering").set("value", "CA")

and then it displays "California". But if you do:

dijit.byId("filtering").set("value", "XX")

it doesn't know what to display because there's no state with the abbreviation of "XX".

Likely what you want is to be setting displayedValue, you can try

dijit.byId("filtering").set("displayedValue", "invalid")

Set() is new for 1.5. Previously it was called attr()

comment:2 Changed 11 years ago by mark007

Thanks Bill, I'll begin to change my code to use displayedValue for FilteringSelects?.

I feel that setting a value of "XX" as you descibe above, that has no state with abbreviation of "XX" should have a different behaviour. Instead of leaving the value that was there previously, which is most definitely the wrong displayed value, an empty string perhaps would be more valid IMHO.

comment:3 Changed 11 years ago by bill

Cc: Douglas Hays added

Yah, I agree, but there was some implementation detail that made doing that difficult, Doug can explain better why it doesn't work that way?

comment:4 Changed 11 years ago by bill

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