1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| jQuery.Conponents.AutoForm.chekMethods = {
'required' : '^.+$',
'number' : '^[0-9]*(\\.|,)?[0-9]+$',
'numberOrNull' : '^[0-9]*(\\.|,)?[0-9]+$|^$',
'phone' : '^[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}$|^[0-9]{1}(\\.| )?[0-9]{3}(\\.| )?[0-9]{3}(\\.| )?[0-9]{3}$',
'phoneOrNull' : '^[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}(\\.| )?[0-9]{2}$|^[0-9]{1}(\\.| )?[0-9]{3}(\\.| )?[0-9]{3}(\\.| )?[0-9]{3}$|^$',
'email' : '^[0-9a-zA-Z_\-]+(\\.)?[0-9a-zA-Z_\-]*@([0-9a-zA-Z_-]+\\.)+[a-zA-Z]{2,4}$',
'emailOrNull' : '^[0-9a-zA-Z_\-]+(\\.)?[0-9a-zA-Z_\-]*@([0-9a-zA-Z_-]+\\.)+[a-zA-Z]{2,4}$|^$',
'name' : '^[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+$|^[A-Z]+$',
'nameOrNull' : '^[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+$|^[A-Z]+$|^$',
'firstName' : '^[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+(-[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+)?$|^[A-Z]+(-[A-Z]+)?$',
'firstNameOrNull' : '^[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+(-[A-Z]?[a-zßàáâãäåæçèéêëìíîïðñòóôõöùúûüýÿ]+)?$|^[A-Z]+(-[A-Z]+)?$|^$',
'IPV4' : '^(((25[0-5])|(2[0-4][0-9])|(1?[0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1?[0-9]{1,2}))$', // 192.168.1.1
'IPV4OrNull' : '^(((25[0-5])|(2[0-4][0-9])|(1?[0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1?[0-9]{1,2}))$|^$', // 192.168.1.1
'IPV6' : '^([A-Fa-f0-9]{4}\:){7}[A-Fa-f0-9]{4}$', // A012:B123:C234:D345:E456:F567:A678:B789
'IPV6OrNull' : '^([A-Fa-f0-9]{4}\:){7}[A-Fa-f0-9]{4}$|^$', // A012:B123:C234:D345:E456:F567:A678:B789
'MacAddress' : '^([A-Fa-f0-9]{2}\:){5}[A-Fa-f0-9]{2}$', // A0:B1:C2:D3:E4:F5
'MacAddressOrNull' : '^([A-Fa-f0-9]{2}\:){5}[A-Fa-f0-9]{2}$|^$', // A0:B1:C2:D3:E4:F5
'date' : function() {
var theDate = this.value.replace(/^[^\d]+/,"");
var theDate = theDate.replace(/[^\d]+/g,"_");
var theDate = theDate.replace(/[^\d]+$/g,"");
var modele = new RegExp('^[0-9]{1,2}_[0-9]{1,2}_[0-9]{4}$');
//alert(this.name+"=>"+modele);
var res = modele.test(theDate);
if (res && this.id) {
this.onValidated(this);
} else {
this.onUnvalidated(this);
}
return res;
},
'dateOrNull' : function() {
var theDate = this.value.replace(/^[^\d]+/,"");
var theDate = theDate.replace(/[^\d]+/g,"_");
var theDate = theDate.replace(/[^\d]+$/g,"");
var modele = new RegExp('^[0-9]{1,2}_[0-9]{1,2}_[0-9]{4}$|^$');
//alert(this.name+"=>"+modele);
var res = modele.test(theDate);
if (res && this.id) {
this.onValidated(this);
} else {
this.onUnvalidated(this);
}
return res;
}
}; //end checkMethods |
Partager