(function($) {
$.fn.validationEngineLanguage = function() {};
$.validationEngineLanguage = {
newLang: function() {
$.validationEngineLanguage.allRules = {
"required":{ // Add your regex rules here, you can take telephone as an example
"regex":"none",
"alertText":"* 需要填入此欄位",
"alertTextCheckboxMultiple":"* 請選擇一個選項",
"alertTextCheckboxe":"* 請選擇一個選項"},
"length":{
"regex":"none",
"alertText":"* 請填入 ",
"alertText2":" 到 ",
"alertText3": " 個字"},
"maxCheckbox":{
"regex":"none",
"alertText":"* 超過最大允許的字元數"},
"minCheckbox":{
"regex":"none",
"alertText":"* 請選擇選項 ",
"alertText2":" "},
"confirm":{
"regex":"none",
"alertText":"* 兩次輸入的值不相同"},
"telephone":{
"regex":"/^[0-9\-\(\)\ ]+$/",
"alertText":"* 錯誤的電話號碼"},
"email":{
"regex":"/^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/",
"alertText":"* 錯誤的電子郵件"},
"date":{
"regex":"/^[0-9]{4}\-\[0-9]{1,2}\-\[0-9]{1,2}$/",
"alertText":"* 錯誤的日期, 請以 YYYY-MM-DD 的格式輸入"},
"onlyNumber":{
"regex":"/^[0-9\ ]+$/",
"alertText":"* 只允許數字"},
"noSpecialCaracters":{
"regex":"/^[0-9a-zA-Z]+$/",
"alertText":"* 不允許特殊字元"},
"ajaxUser":{
"file":"validateUser.php",
"extraData":"name=eric",
"alertTextOk":"* 此使用者已通過驗證",
"alertTextLoad":"* 讀取中.. 請稍後",
"alertText":"* This user is already taken"},
"ajaxName":{
"file":"validateUser.php",
"alertText":"* This name is already taken",
"alertTextOk":"* This name is available",
"alertTextLoad":"* Loading, please wait"},
"onlyLetter":{
"regex":"/^[a-zA-Z\ \']+$/",
"alertText":"* 只允許輸入英文字母"},
"validate2fields":{
"nname":"validate2fields",
"alertText":"* 需要輸入姓和名"}
}
}
}
})(jQuery);
$(document).ready(function() {
$.validationEngineLanguage.newLang()
});
沒有留言:
張貼留言