PDA

View Full Version : BasicForm Combobox with boolean value



lvgunst
23 Feb 2009, 8:10 AM
I hava a BasicForm with a combobox. The combobox has an store with boolean values (true/false).



{
xtype: 'combo',
fieldLabel: 'Nieuwsbrief ontvangen',
hiddenName: 'ReceiveNewsletter',
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [
[false, 'No'],
[true, 'Yes']
]
}),
value: false,
valueField: 'value',
displayField: 'text',
mode: 'local',
triggerAction: 'all',
editable: false,
selectOnFocus: true,
forceSelection: true,
allowBlank: false
}
When I select the true value (Yes) and save it, then load it back in the BasicForm the right value is selected. But when I select the false value (No), save it and reload the form again, no value is selected.

I have the same problem when I'm using 0 and 1 as values.


new Ext.data.SimpleStore({
storeId: 'personType',
fields: ['value', 'text'],
data: [
[0, 'Contactpersoon'],
[1, 'Medewerker']
]
});
Does anyone know if it is possible to use boolean values in a combobox?

Condor
23 Feb 2009, 8:14 AM
You need a value that doesn't evaluate to false. Try 'false' or '0' (string values).

lvgunst
23 Feb 2009, 11:22 AM
Oke thanks. I use a JSON converter, so I will have to change my back-end.