View Full Version : set maxValue during execution

16 Jan 2013, 1:36 AM
I'm trying to set the maxValue of B dynamically and depending of A value but from firebug I get the following error:

TypeError: Ext.getCmp(...) is undefined

Both fields are in the same window and it's mandatory to set A before you can set B

items: [{ name: 'A',
id: 'A',
fieldLabel: 'Number of A',
value: '0',
maxValue: 10,
name: 'B',
fieldLabel: 'Number of B',
value: '0',
maxValue: Ext.getCmp('A').getValue()*10

Any idea how it can be solved? I've read some post but none solve my problem


17 Jan 2013, 1:56 PM
Move the item creation into a method like initComponent so getCmp resolves to something. Honestly, there is a better way and that is to set it int he config object when you are creating the view.