Reputation: 307
I started learning EXT JS a few days ago, and I'm having issues validating the following form. I'm currently just running tests on the "password" field. The submit button is always active, and when I try to check if the form is valid, well it seems to be considered as such.
var form = Ext.create('Ext.form.Panel',{
layout: 'vbox',
width: 300,
height: 100,
defaults: {
labelStyle: 'padding:7 0 0 25;',
},
items: [{
xtype: 'field',
name: 'Username',
fieldLabel: 'Username',
value: 'Your Username',
},
{
xtype: 'field',
fieldLabel: 'Password',
name: 'Password',
value: '',
inputType: 'password',
allowBlank: false,
minLength:5,
/* validator : function(){
alert('ttt');
return false;
},
validateOnChange: true*/
listeners:{
focus : function(){
alert(this.isValid()); // Always shows "true"
}
}
}],
buttons: [{
text: 'Submit',
margin: '0 100 0 0',
formBind: true,
handler: function(){
alert('submitted');
}
}]
});
So what am I missing?
Upvotes: 0
Views: 137
Reputation: 307
So after one and a half hour of debugging, I found that the issue was just the xtype : it should be set to "textfield" instead of "field".
Upvotes: 2