I want to check (do not allow blank) any field of these two! Got some idea from here , but couldn't implement it in version 1.9.1.
Even both fields are checked, which is also excellent. Any inputs ..... guys
Here is my jquery
jQuery.validator.addMethod("require_from_group", function(value, element, options) { alert("xxx"); var valid = $(options[1], element.form).filter(function() { return $(this).val(); }).length >= options[0]; if(!$(element).data('reval')) { var fields = $(options[1], element.form); fields.data('reval', true).valid(); fields.data('reval', false); } return valid; }, jQuery.format("'Please enter either username/ email address to recover password'/Please fill out at least {0} of these fields.")); $("#forgot_pass_form").validate({ rules: { uname: { require_from_group: [1,".send_username"] }, email: { require_from_group: [1,".send_password"] } } });
and here is my html
<form action="#" class="send_form" id="forgot_pass_form" method="POST"> <fieldset> <div class="send_row"> <label class="padding-top10">Email</label> <input type="text" class="send_email" id="email" name="email" /> <em>You need to type an email address</em> </div> <div class="send_row option">OR</div> <div class="send_row"> <label class="padding-top10">Username</label> <input type="text" class="send_username" id="uname" name="uname" /> </div> <div class="send_row send_submitforgotuser"> <input type="submit" value="Submit" /> </div> </fieldset> </form>
I want to just check any field from these two empty fields.
bigZero
source share