PDA

View Full Version : how set a variable MaxValue



SpinoWeb
21 Mar 2011, 4:18 AM
my form has two numberfields:

var fc0 = new Ext.form.NumberField({
xtype : 'numberfield'
,fieldLabel : 'fc0'
,name: 'fc0'
,allowBlank : false
,decimalPrecision : 2
,minValue : 0
});

var fcu = new Ext.form.NumberField({
xtype : 'numberfield'
,fieldLabel : 'fcu'
,name: 'fcu'
,allowBlank : false
,decimalPrecision : 2
,minValue : 0
,maxValue : fc0.getValue()
});

I'd want to set the maxValue of fcu equal to the value of fc0 digited by the user.
The script above does not work. How can do it?

thank u!

fay
21 Mar 2011, 4:27 AM
Add a blur listener to fc0 and use fcu.setMaxValue() within it. Something like:



var fc0 = ....
listeners: {
'blur': function(field)
{
fcu.setMaxValue(fc0.getValue());
}
}
});