美国电话号码验证四个文本框,扩展名[可选]使用jquery validate.js

时间:2012-09-13 11:39:08

标签: jquery

我有一个表单,其中包含四个文本框手机,phone1,phone2&分机。为了验证,我使用了jquery validate.js。它工作正常,但有一个问题,它允许无效数字也像000-000-0000或001-000-0000

以下是我的验证脚本:

$params['rules'][$phone] = {"required": true,"minlength": 3,"digits":true };
$params['messages'][$phone] = {"required":"<div class='error-message'>*This is required </div> <div class='error-arrow'></div> ",
"minlength":"<div class='error-message'>*  Numbers should be 3 digits</div> <div class='error-arrow'></div>","digits":" <div class='error-message'>* Numbers only</div> <div class='error-arrow'></div> "};


$params['rules'][$phone2] = {"required": true,"minlength": 3,"digits":true };
$params['messages'][$phone2] = {"required":"<div class='error-message'>* This is required</div> <div class='error-arrow'></div> ",
"minlength":"<div class='error-message'>*  Numbers should be 3 digits</div> <div class='error-arrow'></div>",
"digits":" <div class='error-message'>* Numbers only</div> <div class='error-arrow'></div> "};

0 个答案:

没有答案