PDA

View Full Version : Button delete value of textField



yannickiwi
23 Feb 2009, 2:14 AM
Hi,

How can I delete the value on a textField?

I have test:


buttons: [{
text: 'Remise ? zéro',
handler: function()
{
document.getElementById('id') = null;
document.getElementById('task') = null;
document.getElementById('date') = null;
}
}]width le id is defined here:


{
xtype:'textfield',
fieldLabel: 'id',
id:'id',
name: 'id',
disabled: true
},{
xtype:'textfield',
fieldLabel: 'task',
id:'task',
name: 'task'
},{
xtype:'textfield',
fieldLabel: 'date',
id:'date',
name: 'date'
}But is not good:


invalid assignment left-hand side
(174 out of range 148)Thank you for your help :)

24 Feb 2009, 8:01 AM
document.getElementById('id') = null;
document.getElementById('task') = null;
document.getElementById('date') = null;

is invalid javascript, you can't nullify the result of a method call.

how about: Ext.getCmp('id').setValue('') or reset()