I am using the jQuery Validation Plugin to validate a number of inputs on a html page. The first name is always required, and either email OR mobile but not both. To do this, I use the require_from_group_exact method.
When the inputs are in this order, validation occurs perfectly:
<form>
Email: <input class="commsinfo" name="email"><br>
Mobile: <input class="commsinfo" name="mobile"><br>
Name: <input name="firstname"><br>
<input type="submit">
</form>
However if you swap the inputs around, validation of the last input (firstname) does not occur properly (you have to type a firstname and then delete it to trigger validation) - why??. This is the desired order and issue I'm trying to solve - is it a bug with the jQuery Validation Plugin or my code?
<form>
Name: <input name="firstname"><br>
Email: <input class="commsinfo" name="email"><br>
Mobile: <input class="commsinfo" name="mobile"><br>
<input type="submit">
</form>
I have created a JSFiddle of the version the does not validate properly. The code for the jQuery.validator.addMethod and $('form').validate can be seen in the fiddle.