PDA

View Full Version : ComoBox setValue



simon
7 Jun 2011, 11:29 PM
If I put combobox into the form which is then rendered into the window, I can't set the value of combobox. I get the following error:
Uncaught TypeError: Cannot read property 'dom' of undefined




var cmbDc = new Ext.form.ComboBox({
/*store and other settings*/
...
});

var saForm = new Ext.FormPanel({
labelWidth: 75,
url: 'sAddressSave.asp',
standardSubmit: false,
frame: true,
buttonAlign: 'center',
bodyStyle: 'padding:5px 5px 0',
width: 350,
defaults: { width: 230 },
defaultType: 'textfield',
items: [{cmbDC}]
});

var wConf = new Ext.Window(
{
id: 'wConf'
, layout: 'form'
, width: 350
, autoHeight: true
, y: 100
, buttonAlign: 'center'
, items: [saForm]
});

/*When I try this, I get an error:*/
cmbDC.setValue(1);


If I try this, it works:
cmbDC.value="1"

but after that I can't change this value:
cmbDC.value="2" - it remains 1

Where is the problem?
thank you,
Simon

Hans Kejser Hansen
8 Jun 2011, 1:36 AM
How do you define the combobox (and it's store) ? I guess not by writing /*store and other settings*/.

jarlau
8 Jun 2011, 2:32 AM
because the combo not rendered.