The value is the text that will be sent to the server if you submit a form containing your select.
It's similar to an option
tag with a value attribute: <option value="op1">option1</option>
. If you omit the value attribute on tag, the submitted text will simply be the label text "option1".
The values don't have to be integers - you can have options with {label: foo, value: foo}
, as long as foo is unique among the options. If you omit the value property here, the submitted value will be undefined, and the dijit will (as you've noticed) behave generally strange.
Edit after a bit of experimentation: When using the Select dijit, the values in the options
array (or, in fact, the ids in a store) must be strings. Otherwise, giving the select a default value will not work. E.g.:
new Select({
value: 3,
options: [ {label: "foo", value: 1}, {label: "bar", value: 3}]
})
.. will not set "bar" as the default selected option, and highlighting the selected item in the dropdown doesn't work. You have to use an option array with string values:
options: [ {label: "foo", value: "1"}, {label: "bar", value: "3"}]
Not 100% sure about the reason behind this.