-
Email validation on textfield
Email validation on textfield
Hi there,
Is this the right way 2 check a email text field??
first i create the plugin
Ext.ux.validateEmailAddress=Ext.extend(Object,
{
init :
function(fld)
{
fld.on('blur',function(field)
{
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
//trim spaces
var newEmailAddress=field.getValue().replace(/^\s+|\s+$/g,"");
if(!reg.test(newEmailAddress) )
{
Ext.MessageBox.show(
{
msg:
'Ongeldig E-mailadres opgegeven!',
buttons:
Ext.MessageBox.OK,
animEl: 'mb9'
,
maxWidth:
300,
icon:
Ext.MessageBox.WARNING
}
);
field.markInvalid();
}
}
);
}
}
);
second i create the textfield with the plugin
{
fieldLabel: 'E-mailadres'
,
enableKeyEvents :
true,
id:'veld_9'
,
allowBlank:
false
,
name: 'veld_9'
,
plugins:
new Ext.ux.validateEmailAddress(),
width:
300
}
I wonder if this the right solution for checking a email on textfield?
-
have you looked at vtypes?
-

Originally Posted by
moegal
have you looked at vtypes?
thanks for the intel
-
You just need vtype: 'email'
Also, this is the wrong forum for asking questions.
Similar Threads
-
By devtig in forum Ext:Bugs
Replies: 2
Last Post: 13 Mar 2011, 11:04 PM
-
By ael in forum Ext 3.x: Bugs
Replies: 6
Last Post: 7 Jan 2011, 9:57 AM
-
By issameddine in forum Ext 2.x: Help & Discussion
Replies: 2
Last Post: 22 Sep 2010, 1:05 AM
-
By ext_fan in forum Ext 2.x: Help & Discussion
Replies: 5
Last Post: 17 Apr 2008, 10:41 PM
-
By tnietupski in forum Ext 2.x: Help & Discussion
Replies: 1
Last Post: 19 Mar 2008, 3:04 PM
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us