Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Todd Kempf on Apr 06, 2009 14:02
open dhtmlx forum
Dafault Values and pre-populating the combo box

Tried that and it didn't work.

I am using the combo in a small record/database editor, one script adds a record another allows the editing of the already submitted record. The function to add a new records works perfectly, however on edit is where the issues happen.

I am using setComboValue to set the form with the zip code data stored in the database. Prior to the edit being submitted I check to make sure the value of  Zip_new_value is false and thus in the list, however if the user doesn't edit the zip field, Zip_new_value is true meaning the zip isn't in the list, but it truly is. The code to set Zip_new_value isn't run until the combo is clicked. Seems like we need to run the code which checks the list when you do a setComboValue.... or something like that, instead of having to click in the combo box each time..

How should one do error checking? Or how should I set a default value for the combo box? That is all I am really interested in, if there is a better method please let me know.

I know I could do a read only list but I don't want to have 40,000 zip codes in the combo. I love the way the form does autocomplete and filtering directly from my database! However, I also want to make sure the zip code entered is in my database.

Thanks for any guidance.

PS. I am using the 100000, code in my testing.
Answer posted by Alex (support) on Apr 07, 2009 01:16

In case of non-editable combo, you also can use the same approach:

combo.addOption("","")
combo.setComboValue(""); 

The following call ( the same as zip_new_value)  shows false message:

alert(combo.DOMelem_hidden_input2.value)