View Full Version : Combobox submits displayField instead of valueField

28 Dec 2010, 1:33 PM
If I use the typeAhead feature of the combobox to pinpoint the selection, the form submits the combobox with the displayField as the submission instead of the selections value. Here is the firebug output. The fk_user_id should be a number (the valueField). Is there a way to constrain the combobox to just to the elements in the combobox store? I know I could use the current functionality to add entries into the store on the fly, but I don't need that in this case.

fk_user_id USER 1
task update

Edit, I know I typed "Is there a way to constrain the combobox to just to the elements in the combobox store", but even if I type out the name of an entry that exists in the combobox store, the form still submits the displayField. If I pull down the list and click a selection, I get the valueField submitted which is what I need.

28 Dec 2010, 2:12 PM
The hiddenName config option for a ComboBox is intended to overcome the displayField/valueField issue around form submits. To force the user to select one of the values in the store you could also try the config option forceSelection: true.

If that doesn't help could you post the code you're using to create your ComboBox and the code for submitting the form?

29 Dec 2010, 6:13 AM
Thanks Skirtle, forceSelection: true seems to have helped, however, I am still encountering a problem with the combobox. If I click the dropdown arrow of the combobox and click a selection, I get the behavior I expect to get. However, If I type into the combobox, then click a selection from the "narrowed" list of choices, the number gets submitted, but it appears to clobber the store. From that point on, if I load the grid with more data, the combobox won't render anything other than the last entry (that I typed in).

29 Dec 2010, 6:51 AM
Call combo.store.clearFilter() before setting a new value.

ps. Are you using an older Ext version where ComboBox didn't have a clearFilterOnReset config option yet?

29 Dec 2010, 7:02 AM
Condor, you are spot on as always. I was never reloading that particular store, so the filter, obviously, persisted.

Thanks again everyone.