dimanche 25 mai 2014

isValis() on formPanel

Having this form panel as a login page:

Code:



Ext.create('Ext.container.Viewport', {
renderTo: Ext.getBody(),
layout:{
type:'fit'
},
items: [
{
xtype: 'form',
id: 'loginForm',
border: false,
layout: {
type: 'vbox',
align: 'center',
pack: 'center'
},
height : Ext.getBody().getViewSize().height,
width : Ext.getBody().getViewSize().width,
defaultType : 'textfield',
listeners: {
afterRender: function(thisForm, options){
this.keyNav = Ext.create('Ext.util.KeyNav', this.el, {
enter: function(){if(loginForm.getForm().isValid())
login(loginForm);
},
scope: this
});
}
},...........

I'm trying to configure pressing enter for submitting, after filling the details. this line:

Code:



enter: function(){if(loginForm.getForm().isValid())

is not working properly, however, if i replace it with:

Code:



enter: function(){Ext.getCmp('firstField').getValue().length && Ext.getCmp('secondField').getValue().length

it works just fine. but i wanted to use isValid() can anyone help me please?


Aucun commentaire:

Enregistrer un commentaire