EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: 2plus2 on June 13, 2013, 04:58:05 PM



Title: ComboBox setValue for non-existent value
Post by: 2plus2 on June 13, 2013, 04:58:05 PM
When you do a load form, with a combobox, if you have a value to "set" in the combo box and the value doesn't exist, the load method puts the unmatched value in the textbox. e.g. I'm trying to set the combobox value to "5", and since 5 doesn't exist in the drop down, "5" is put in the textbox instead.

It should just not load the value at all. (Same with form submission, if the data in the text box doesn't match an option in the drop down, it shouldn't submit that unmatch value/text with the form submission.)

Anyway, is there an event I can utilize to detect this "failed" setValue? Or do I have to manually check it with the validate / isValid method immediately after setting it?

UPDATE: Here is a Fiddle I setup to show the action described above:

http://jsfiddle.net/FrEHv/

I also added the validate / isValid check - and it always returns true. How can I verify the data entered if it's always validates true? Or am I using this method incorrectly?


Title: Re: ComboBox setValue for non-existent value
Post by: stworthy on June 13, 2013, 06:50:14 PM
Here is the updated example that extends the 'exists' validating type.
http://jsfiddle.net/FrEHv/1/


Title: Re: ComboBox setValue for non-existent value
Post by: 2plus2 on June 14, 2013, 10:18:22 AM
Thanks - much appreciated.