Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by chrisz on Apr 08, 2009 08:12
open dhtmlx forum
Reset a Combo

I have a Combo in a form. When it is initialized, there is nothing selected and the text is blank. It's state is:
-- The UI displays nothing
-- selectedValue = null
-- actual value = ""

If the user makes a choice, but then clicks a 'reset' button, I want to return the combo to it's original state. It seems the only way to reset the combo to it's original state is to use *3* functions:
combo.setComboText(""); -- this blanks the text in the UI
combo.setComboValue(""); -- this sets the 'actual value' to blank
cpeciesCombo.unSelectOption(); -- this sets the 'selected value' to null

Is this correct? Or is there a single "reset" function I'm missing?

Thanks
Answer posted by Alex (support) on Apr 08, 2009 08:48

You can use only two methods:

combo.setComboValue(""); -- this sets the 'actual value' to blank 
cpeciesCombo.unSelectOption(); -- this sets the 'selected value' to null

Using combo.setComboText("") isn't necessary.