Perfect, thank you all.
Luis
Its in the validate documentation
http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression
In your case
rules: {
newColor: {
required: function(element) {
return $("#color").val() == -1;
}
}
Don't really understand the Validate Plugin, but you can use this to
validate if user selected newcolor or any other:
if(parseInt($('#color').val) === -1 && $('#newColor').val().length ===
0){
/** user hasn't filled out a new color in #newColor when choose to
"Specify new color" **/
}else{
3 matches
Mail list logo