PDA

View Full Version : Get numberfield value after enter key



tombal93
21 Jul 2010, 3:07 AM
i have a form with setvalue for a numberfield. I use defaultButton plugin to validate my form on ENTER.
I want to use allowblank depending on this field value.



new Ext.form.NumberField(
{
xtype:'numberfield',
id:'idoffre',
fieldLabel: 'offre',
name: 'idoffre',
width:'166px',
validateOnBlur:false
})


When i focus the field and change the value, after i use enter key but have old value and not the new value (i use an alert in the button handler)



new Ext.Button(
{
text: 'Recherche',
width:'100px',
id:'lebouton',
plugins: 'defaultButton',
handler: function() {
Ext.Msg.alert('IDOFFRE', Ext.getCmp('idoffre').value);

if (Ext.getCmp('idoffre').value != undefined && Ext.getCmp('idoffre').value !='' ) {
Ext.getCmp('secteur_id').allowBlank=true;
Ext.getCmp('ville_id').allowBlank=true;
} else {
Ext.getCmp('secteur_id').allowBlank=false;
Ext.getCmp('ville_id').allowBlank=false;
};
simple.getForm().getEl().dom.action = 'de_rech_offre.php';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();
}
})


Thanks for your help