PDA

View Full Version : Simple question- how to catch blur events on form text field



lkasdorf
6 Sep 2007, 8:25 AM
Can somebody point me to an example of how to catch blur events from a text field in a form?

I assume that I am supposed to addListener to the form something like this:


regisForm = new Ext.form.Form({
. . .
});

regisForm.addListener('blur', function(){ alert('blur was fired'); });


Do I need to configure the text field that I care about somehow? The docs on the textfield lists the events that are fired, but I've seen where I am supposed to set up anything to cause that to happen.

If there was a simple example somewhere, I could figure it out.

Thanks!
Lynn Kasdorf

fay
6 Sep 2007, 8:31 AM
If you want to do it on an individual field basis...

With the \examples\form\dynamic.js example, I changed the first 'Simple Form' to:


var fldFirstName;

var simple = new Ext.form.Form({labelWidth: 75, url:'save-form.php'});

simple.add(
fldFirstName = new Ext.form.TextField({fieldLabel: 'First Name', name: 'first', width:175, allowBlank:false}),
//...
);

fldFirstName.on('blur', function(fld){
alert('test', 'blurred');
});