View Full Version : Authorize hyphens in email

28 Apr 2009, 1:55 AM

i have a field "email" in my form like this :

fieldLabel: 'Email *',
name: 'user_mail',
blankText: 'Le mail est obligatoire',
vtypeText: 'My message'

But "-" is not authorized in the field. (Example : If i put "[email protected]")
How can i authorize hyphens in an email ?


28 Apr 2009, 5:26 AM
Did you take a look at the VTypes API (3.0 rc1) (http://extjs.com/deploy/ext-3.0-rc1/docs/?class=Ext.form.VTypes)?

This is a singleton object which contains a set of commonly used field validation functions. The validations provided are basic and intended to be easily customizable and extended.

To add custom VTypes specify the vtype validation test function, and optionally specify any corresponding error text to display and any keystroke filtering mask to apply. For example: ...

email( String value ) : void
The function used to validate email addresses. Note that this is a very basic validation -- complete validation per the email RFC specifications is very complex and beyond the scope of this class, although this function can be overridden if a more comprehensive validation scheme is desired. See the validation section of the Wikipedia article on email addresses for additional information.