It appears that the digits validator doesn't check it's value. I have
a situation where, depending on the value of one field, a second field
may or may not be required to contain only digits. The only way I can
see to achieve this within the framework would be:
$(document).ready(function() {
$("#formid").bind("validate",function(e,validator) {}).validate({
rules: {
fieldOne: {required : true},
fieldTwo: {
required: true,
digits: function(e) { return $
(e.target).find("input[name=fieldOne]:checked").val) == 'digits'; }
}
}
}
}
This should make fieldTwo always required to have a value, and
required to contain only digits if fieldOne's value is 'digits'. But
even if I change the second requirement to digits: false; for testing
it always requires the field to contain only digits.
I'm using jQuery Validate 1.2.1
Any pointers would be greatly appreciated.