Opened 13 years ago

Closed 12 years ago

#1485 closed defect (fixed)

Select widget setValue() function cannot work

Reported by: bill Owned by: Douglas Hays
Priority: high Milestone: 0.9
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

The value of a Select widget, just like the value of a <select> element, is the hidden value, not the label (ex, although the Select widget displays "California", the value is "CA").

So getValue() should return "CA", and more importantly, calling setValue("CA") should set display "California".

As Joose pointed out, in order for that to work, a dataUrl based Select widgets needs to query the server and say "what's the label corresponding to 'CA'?". Currently there's no defined interface to do this.

The alternative is to make setValue() take both the value and the label (which is ugly because it's inconsistent with all the other form widgets), or to disallow setValue() (which is also ugly for the same reason, and also because it breaks FormContainer?), or maybe some other alternative I haven't thought of. Anyway, have to make a decision on that.

Change History (3)

comment:1 Changed 13 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays

comment:2 Changed 12 years ago by haysmark@…

Select's setValue (now) takes the hidden value. getValue returns the hidden value. setValue applies the corresponding label by reverse lookup.

comment:3 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [8352]) Port of ComboBox?(=AutoCompleter?) and Select widgets to 0.9 dojo by haysmark@…. Fixes #2189, #1504, #1451, #2244, #2384, #2070, #899, #912, #1267, #1339, #1456, #1484, #1485, #2558, #1186

Note: See TracTickets for help on using tickets.