Reputation: 1743
Hey guys! I have a dijit.form.ComboBox that needs have value checking applied against it. Specifically the box is below...
<input dojoType="dijit.form.ComboBox"
store="xvarStore"
value="[% xv %]"
searchAttr="name"
name="xvar_names_[% section_count %]_arg_[% loop.count %]"
id="xvar_names_[% section_count %]_arg_[% loop.count %]"
/>
the [% ..... %] stuff are values from Template Toolkit.
Anywho, the point of a ComboBox of course is that you can select a value or put your own in and that functionality I am not looking to change. What I do need to do is pop up or somehow nag someone if they put a value in that not in the list.
Anyone have a clue how I might do this. I thought about an onBlur event but I'm still a little mystified.
Any pointers in the right direction would be appreciated. Janie
Upvotes: 0
Views: 3132
Reputation: 10559
If you want to require that the user enter a value that is in the list, then you probably want FilteringSelect, not ComboBox. FilteringSelect does exactly this.
http://dojotoolkit.org/reference-guide/dijit/form/FilteringSelect.html
I've contrasted these two widgets in a blog post:
http://kennethfranqueiro.com/2010/06/combobox-vs-filteringselect/
Upvotes: 2
Reputation: 15370
The documentation for dijit.form.ComboBox is probably the best place to start, but you have the right idea. The onChange
or onBlur
events seem the most appropriate, but you could also write a custom validate
function that would nag the user if values weren't in the list.
Upvotes: 1