PDA

View Full Version : Valid event deprecated



Supial
4 Jan 2012, 7:24 AM
Greetings,
I'm migrating my application from 3.4 to 4.0 and I've extended some of the core input fields. In 3.4, I was able to handle changes in form fields (ex: TextField) using the "valid" event. This event doesn't seem to exist in 4.0 and I'm wondering if there is a counterpart for this event? I need to be able to interact with the component only when the field is/has been validated. I don't want to use the "change" or "blur" events, since these events fire irregardless if the value in the field is valid.

For example:
3.4:


my.TextField = Ext.extend(Ext.form.TextField,{
binding: '',

readOnly: false,

initComponent: function(){
var config = {
width: 200,
readOnly: this.readOnly
};
Ext.apply(this, Ext.apply(this.initialConfig, config));
my.TextField.superclass.initComponent.apply(this, arguments);
},

onRender: function(ct, position){
my.TextField.superclass.onRender.call(this, ct, position);

this.on('valid', function(field) {
var bind = document.getElementById(field.binding);
if (bind != null) {
bind.value = field.getValue();
}
});
}
});


Cheers,
Marcel

mitchellsimoens
4 Jan 2012, 7:51 AM
validitychange

Parameters are the field, is valid (boolean) and event options.

Supial
4 Jan 2012, 7:59 PM
Thanks for the response.
The "validitychange" event seems to only fire for the first character entered for Text Field. So if the user types "Hello World", the event only fires for the first "H". This causes a problem since I can not use this event to gather the entire value of the input field when it is valid. This makes sense for the event, but doesn't give me the equivalent functionality as the 3.4 "valid" event, which seems to fire for every input value which is valid.

Cheers,
Marcel

mitchellsimoens
5 Jan 2012, 5:42 AM
When typing 'Hello World' does the valid state change past typing 'H'?

Patlatus
14 May 2012, 6:02 AM
When typing 'Hello World' does the valid state change past typing 'H'?
That is a problem.

Now in ExtJS 4.x we have only validity change event, when validity state changes, that is we can get the first typed valid value and the first typed invalid value. But in previous 3.x version we could get the last typed valid value.

So we still have now no functionality to get last typed valid value, as we had in 3.x version.