I can’t make work the validation plugin when I try to validate a dropdown. And in chrome I am getting a warning message that it says: “nothing selected, can’t validate, returning nothing “
$('#wpuf_form').validate({
debug: true,
rules: {
"category[]" : {
required:{
depends: function(element){
return $('.cat').val() == '-1';
}
}
}
},
submitHandler: function(form){
alert('test');
}
});
<!-- this the html -->
<form id="wpuf_form" name="wpuf_form" action="" method="POST">
<select name="category[]" id="cat" class="cat">
<option value="-1">– Select –</option>
<option class="level-0" value="1">test</option>
<option class="level-0" value="2">test2</option>
<option class="level-0" value="3">test3</option>
</select>
<input type="submit" name="wpuf_new_post_submit" value="Submit Creation">
</form>
Any help would be highly appreciated.
Thanks in Advance!
I just solved my problem it is just the validate plugin doesnt like the value == ‘-1’, I had to change it to value == ”, I wish I could know why… since i was using a wordpress function to do this i used javascript to change the value by default to cat.options[cat.selectedIndex].value = ”;