I am using jQuery Validation Plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/)
I have wrote following rule
jQuery.validator.addMethod("valueNotEquals", function(value, element, arg){
return arg != value; }, "Value must not equal arg.");
I have wrote following rules and message
rules: {
filelist:{required:function() {return jQuery('input[name|="producthosting"]:checked').val() == 'us';},valueNotEquals:"-1"}
},
messages: {
filelist:{
required:"Please select a file",
valueNotEquals:"Please select a valid file"
}
}
Now, I need to validate valueNotEquals only if input with name "producthosting" is "us"
right now, above rule throws error even if "producthosting" value is not equal to "us"
How can I achieve it?