Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12434 closed defect (invalid)

Select: can't select int values programmatically

Reported by: milad Owned by: Douglas Hays
Priority: high Milestone: 1.7
Component: Dijit - Form Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

hi all i create dijit.form.Select programmatic,if one option have Int value i cant select it programmatic,see attachment please.

Attachments (2)

dijit.form.select.php (1.2 KB) - added by milad 9 years ago.
12434.patch (428 bytes) - added by Douglas Hays 9 years ago.
possible fix

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by milad

Attachment: dijit.form.select.php added

comment:1 Changed 9 years ago by bill

Component: DijitDijit - Form
Owner: set to Douglas Hays

comment:2 Changed 9 years ago by bill

ooghry - Is it just that you messed up the data types? You defined value as a number yet call attr(value, '2'), passing in a string.

Changed 9 years ago by Douglas Hays

Attachment: 12434.patch added

possible fix

comment:3 Changed 9 years ago by Douglas Hays

Milestone: tbd1.7

Bill, the fix seems to be to loosen the type restrictions on a comparison (see patch). I can't find anything that this will break, but I'm not sure why the === was used in the first place. Any ideas?

comment:4 Changed 9 years ago by bill

Looking at _FormSelectWidget.js, it seems like value is required to be a string. That's how it's documented in dijit.form.__SelectOption, plus multiple methods (getOptions() and removeOption()) can take either a number or string as an argument, but treat the number as an index (nth child) indicator.

See also #11545 and the patch attached there, which goes in the opposite direction (although I think that patch is stale).

So I don't think this ticket is invalid.

comment:5 Changed 9 years ago by bill

Summary: Select:Int value cant select programmaticSelect: can't select int values programmatically

Oops, double negative, I meant that I think this ticket is invalid.

comment:6 Changed 9 years ago by Douglas Hays

Bill has decided to keep numeric values reserved for indexing the options array.

comment:7 Changed 9 years ago by Douglas Hays

Resolution: invalid
Status: newclosed

comment:8 Changed 9 years ago by bill

For the record, I can see the value (no pun intended) of enhancing Select to allow numeric values, it's just that it confuses the current API because with a select list like:

<option value=10>...</option>
<option value=20>...</option>
<option value=30>...</option>
...

the meaning of

removeOption(10)

becomes unclear, it could be:

  • remove the tenth option in the list
  • remove the option with value == 10
Note: See TracTickets for help on using tickets.