jQuery Validation Plugin query -
i have been trying add validation phone field accept 10 14 digits (other better uk phone validation methods welcome).
i using jquery validation plugin.
<form class="form" id="lg.callback.form" action="[[~[[*id]]]]" method="post"> <input type="hidden" name="nospam:blank" value=""/> <label for="name"> name: <span class="error">[[!+fi.error.name]]</span></label> <input id="name" type="text" name="name" value="[[!+fi.name]]" required /> <label for="phone"> phone: <span class="error">[[!+fi.error.phone]]</span></label> <input id="phone" type="text" name="phone" value="[[!+fi.phone]]" class="phone"/> <input type="submit" value="request call back"/> </form> <script> $("#lg.callback.form").validate(); </script>
i did try following:
$("#lg.callback.form").validate({ rules: { phone: { required: true, digits: true, minlength: 10, maxlength: 14 } } })
but not work expected.
advice appreciated.
try changing id of form tag. id must not contain special character.
try giving id lgcallbackform
after changing id code working fine. please check link code
Comments
Post a Comment