Dojo Toolkit - How to Get the Value Attribute From a Dijit ComboBox
I spent a couple of hours today with Dojo Toolkit trying to figure out how to get the value attribute (instead of the text value) from the dijit.form.ComboBox widget’s option elements. A bunch of Google searches ended in finding other people who asked the same question, but no real answers.
So how do you get the value attribute from a Dojo ComboBox widget’s selected option element?
You can’t except by some Javascript manipulation. The widget wasn’t designed for value attributes. See here on the official Dojo documentation:
note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value. (source: http://dojotoolkit.org/reference-guide/dijit/form/ComboBox.html#id3)
So use FilteringSelect instead. It will return the value attribute like you expected.