4 * Copyright(c) 2006-2007, Ext JS, LLC.
6 * Originally Released Under LGPL - original licence link has changed is not relivant.
9 * <script type="text/javascript">
12 * @class Roo.form.VTypes
13 * Overridable validation definitions. The validations provided are basic and intended to be easily customizable and extended.
16 Roo.form.VTypes = function(){
17 // closure these in so they are only created once.
18 var alpha = /^[a-zA-Z_]+$/;
19 var alphanum = /^[a-zA-Z0-9_]+$/;
20 var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,24}$/;
21 var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
23 // All these messages and functions are configurable
26 * The function used to validate email addresses
27 * @param {String} value The email address
29 'email' : function(v){
33 * The error text to display when the email validation function returns false
36 'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',
38 * The keystroke filter mask to be applied on email input
41 'emailMask' : /[a-z0-9_\.\-@]/i,
44 * The function used to validate URLs
45 * @param {String} value The URL
51 * The error text to display when the url validation function returns false
54 'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',
57 * The function used to validate alpha values
58 * @param {String} value The value
60 'alpha' : function(v){
64 * The error text to display when the alpha validation function returns false
67 'alphaText' : 'This field should only contain letters and _',
69 * The keystroke filter mask to be applied on alpha input
72 'alphaMask' : /[a-z_]/i,
75 * The function used to validate alphanumeric values
76 * @param {String} value The value
78 'alphanum' : function(v){
79 return alphanum.test(v);
82 * The error text to display when the alphanumeric validation function returns false
85 'alphanumText' : 'This field should only contain letters, numbers and _',
87 * The keystroke filter mask to be applied on alphanumeric input
90 'alphanumMask' : /[a-z0-9_]/i