Reputation: 304
I am having several drop-down in my HTML and I am using jQuery Selectbox plugin (selectbox()) for customized drop-down.
Also I need to validate the form, for which I am using jQuery.validate js.
When I apply the selectbox()
like $("#pd_subject").selectbox();
to the dropdowns jQuery.validate does not validate the dropdown at all,
Fiddle Case 1 : Case1
but when I remove the selectbox() property from dropdowns, jQuery.validate starts validating them.
Fiddle Case 2 : Case2
What could be the hurdle in first case??
Upvotes: 0
Views: 613
Reputation: 304
Figured it out.
The Latest jQuery.validate.js (1.9.0 & more) ignores the hidden fields and only validates the visible fields on the form.
> ignore: ":hidden",
Where as the older version of validate.js (1.8.1 & less) has this line:
> ignore: [],
Which includes every field on the form, whether it is visible or not.
The selectbox() plugin simply hides the drop-down and adds new div in the HTML supporting the design and customization
<select id="qwerty" name="qwerty" sb="55594954" style="display: none;">...</select>
<div id="sbHolder_55594954" class="sbHolder">.....</div>
and that's why the dropdown keep escaping from validation.
Updated fiddle with old validate.js here: http://jsfiddle.net/UKDbq/2/
Upvotes: 2