ExtJS ComboBox set both displayValue/value

comboboxextjs

I'm working on some management system using PHP & some ExtJS.
Generally, I generate all add/edit forms for every object of my system on-the-fly with PhpExt,
but there's a trouble: I can't set both value of a combobox (e.g. object ID) & value that will be shown for the user (object's title). Moreover, I don't know any way to do it with ExtJS itself.

How can I set one value to combobox hidden field & another – to be shown to the user?

UPD #1: I know about 'displayField'/'valueField' properties of ComboBox, what I need to know is this: I have ExtJS ComboBox instance, which method of this instance should I call to set what will be shown in it without changing it's 'valueField value'??

(I have a store of data, assigned properly, but it's remote and will be loaded only on change of this field. If I edit my object and have some of combo's already filled I can choose between assigning ID of related object in them (which is insecure and just doesn't look nice) and title of related object (but then, if value of this combo will not be changed I will get this string instead of ID in PHP script handling this form))

Thanks in advance!

Best Answer

The values are set through displayField (what the user sees) and valueField (what the actual value is). You need to assign these in the config to fields in the attached store.

Related Topic