1.) I have a code script to check if the user has entered a correct email format;
if (val.search("[a-z]+@[a-z]+[.][a-z]+") == -1)
Ext.Msg.alert("Error", "Invalid e-mail address!!");
This code is incorrect as the username and domain name could take in Numbers as well. So how do i correct the code ?
2.) In the view, i have 2 fields; password and retype password. How do i check if these 2 are equal ?
{
xtype:'textfield',
name:'password',
label:'Password'
},
{
xtype:'textfield',
name:'rpassword',
label:'retype password'
}
]
},
{
xtype:'button',
id:'pwdButton',
text:'register',
ui:'confirm'
}
3.) Is there a possibility to do Ajaxified error checking, meaning to pop up error messages as the user goes to the next field (without having to wait till he clicks the Register button)
For performing the
emailvalidation, you can check out my below code. It also works out, if theusernameanddomain namehaveNumbers.For checking if user retyped the same password correctly, you can check out the below code,’
meaning to pop up error messages as the user goes to the next field (without having to wait till he clicks the Register button)
You need to listen for the blur event of any form field. So, when that p’cular field looses
focus, it will call theblur()function and then you can perform the validation w/o having to hit theRegisterbutton.