PDA

View Full Version : combo setValue and hiddenValue



PCSpectra
1 Feb 2010, 11:37 AM
My combo's are configured in such a way that the testual part of the element is what is shown to endusers but the ID of each entry is what is submitted to the server.

I have tried setting setValue() dynamically after adding a new record but upon form submit the textual value is returned not the ID which I need to avoid having to perform some weird reverse lookup operation to extract the ID.

Basically I capture a blur event in each combo and prompt the user to create a new record in the DB if the element does not exist in the data store hitherto. The code then invokes a PHP script, creates the record and calls setValue() on the combo with the textual value just added to the database, but tis doesn't POST properly.

I need to currently combo.reset() the contents and have the users manually select the entry they just created. Obviously I would rather automate this.

I have tried instead setting the setValue() with the ID returned by the PHP script but this of course comes out as ID not the textual name, although upon opening the drop down the proper item is selected. Ugh!!! B)

If I setValue() on items that are in the list initially setting the number actually results in the textual form being shown, what am I missing?

Cheers,
Alex

fay
1 Feb 2010, 12:59 PM
Have you specified a 'hiddenName' in the combo's config? See http://www.extjs.com/deploy/dev/docs/?class=Ext.form.ComboBox or the xml-form example for this.