Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#7795 closed defect (fixed)

Cannot get value attribute from ComboBox; can only get displayed value

Reported by: ptwobrussell Owned by: Douglas Hays
Priority: high Milestone: 1.3
Component: Dijit - Form Version: 1.2beta
Keywords: Cc:
Blocked By: Blocking:

Description

As of the last night's nightly, you can go to a page in the tests like http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/_autoComplete.html?testWidget=dijit.form.ComboBox and verify that a lookup for a value attribute like dijit.byId("setvaluetest").attr('value') returns the displayed value

It appears that this is an issue regardless of whether a select element is used with option elements, or if the combobox is backed by a datastore.

Change History (5)

comment:1 Changed 11 years ago by Douglas Hays

Milestone: tbd1.3
Resolution: invalid
Status: newclosed

ComboBox? only has 1 value - the displayed value. Option tag value attributes are ignored. FilteringSelect? is the widget with a hidden value.

comment:2 Changed 11 years ago by ptwobrussell

Resolution: invalid
Status: closedreopened

Before we're so quick to close these kinds of bugs out, maybe we should start taking the time to ask whether or not the confusion was warranted, and if so, spend a few minutes updating the documentation along the way? For example, the summary comment in ComboBox?.js doesn't explicitly point this out, and it would be virtually impossible to deduce it from reading the source because the dijit form inheritance hierarchy is -- well, a bit complex.

IOW, I think we ought to be more deliberate about considering whether the underlying issues in bugs

I would attach a patch to this, but frankly, it would be trivial for someone with commit rights to add "Differs from FilteringSelect? in that the displayedValue and value attributes are always the same. Any option tags supplied are ignored for ComboBox?" or something like that.

If you really want to close this out without updating the source docs then go ahead, but I think it's a bad idea.

comment:3 Changed 11 years ago by dante

Owner: set to Douglas Hays
Status: reopenednew

I've updated http://docs.dojocampus.org/dijit/form/ComboBox to include this point. It should also go in the description: area of the in-line comments as well. Please review the link as well to ensure accuracy, as I'm not clear on this myself.

comment:4 Changed 11 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

Updated dojocampus to reflect that ComboBox? has no hidden value, unlike FilteringSelect?.
The dojocampus doc info already contained:
Native SELECT combo-boxes always have value/description pairs, e.g. the OPTION's value attribute is used as the submit value and the OPTION's child text node is used as the displayed value. For ComboBox? widgets, only the OPTION's child text node is used as both the submit value and the displayed value.
so I duplicated this idea in the javascript description via [15524].

comment:5 Changed 8 years ago by bill

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