PDA

View Full Version : how to render (modify) combo field display value?



Webtel
24 Nov 2011, 7:04 AM
in the drop down html is accepted.

but after selecting item field is populated with html tags.

in ext 3 i fixed it somewhat like this:


onSelect : this.setRawValue(Ext.util.Format.stripTags(this.getRawValue()));

now it sets also Value (null) and then submits raw value.

What is the good way to do this? i need html tags in the list (besides dropdown template - each item is complex)

mitchellsimoens
24 Nov 2011, 8:02 AM
Why not put this into setValue to go through value (remember, it can be an Array).

Webtel
24 Nov 2011, 9:54 AM
thanks for tip. im in a single select scenario. using an array would i guess change submitted value?


Sets the specified value(s) into the field. For each value, if a record is found in the store that matches based on the valueField, then that record's displayField will be displayed in the field. If no match is found, and the valueNotFoundText config option is defined, then that will be displayed as the default field text. Otherwise a blank value will be shown, although the value will still be set.

i ended up with modyfying drop down template and adding another field to combos store just to display in the list. i guess thats the way it should be done. not the old switchero way :)

skirtle
24 Nov 2011, 7:33 PM
i ended up with modyfying drop down template and adding another field to combos store just to display in the list. i guess thats the way it should be done. not the old switchero way :)

I'm inclined to agree. I don't like the idea of having redundant data in the store but trying to beat the combobox into submission seems unnecessarily complicated. Adding the extra field to the store should be pretty trivial using a convert function to strip the HTML tags.