我有一个表格,其中包含四个文本框电话、电话 1、电话 2 和分机。对于验证,我使用了 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> "};