Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery.validate validating disabled field

I have a drop down in a form which controls which fields will be enabled/disabled on the form using jQuery's .show() and .hide(). In my jquery.validate rules, I have all the fields as required.

This is what my jquery.validate rule looks like

$("#new_course").validate({
ignore: ":disabled",
rules: {
"course_init_on": {required: true},
"mins_before": {required: true},
    .....

With the code, above it still validates the field that are hidden and stops the form from submitting.

like image 419
ed1t Avatar asked Dec 16 '22 12:12

ed1t


1 Answers

What I can see is that you have added ignore ":disabled" which is different than ":hidden"

I think you should use:

$("#new_course").validate({
ignore: ":hidden",
...
like image 84
Mo Valipour Avatar answered Dec 24 '22 14:12

Mo Valipour