View Full Version : advanced management of a combobox into a form

31 May 2012, 4:46 AM
i've a form with a combobox pre-loaded with data
the selected value of the combo is automatically setted when the form is binded to the data.
But when the current value of the record binded to the form(the field that must set the vaule to combobox) doesn't match whit any values into the combo
i'd like that the combobox will show me an empty element and not the value of the field
how can i accomplish this, is there any combo propery simply?


how can i color the combobox of red if the form's field doesn't match with any combobox elements?

31 May 2012, 1:29 PM
You can just load the store with a 'blank' record for selection:

listeners: {
load: function() {
newRecord = Ext.data.Record.create([
{name: 'id', type: 'int'},
{name: 'name', type: 'string'}

var record = new newRecord({
id: 0,
name: '-'



1 Jun 2012, 1:44 AM
yes but if the value of the record's field associated with the form that it's used to select the corresponding combo value doesn't match with "0" (the value of the new empty added element) it will continues to show me a different value

it can be an acceptable behaviour if i change the color the combo to highlight that a problem is occourred
or a least i mustn't show nothing

1 Jun 2012, 5:07 AM
Those values are examples, you will need to decide what they are.
For this behavior, you will need to 'blank' value for the combo to display, as it is based on a store.