0

Here is my problem, I'm using jQuery validate to validate a form. Problem is,I have special styling for my select boxes, I use the bootstrap select.

Now, this basicly re-generates an UL with a LI dropdown.

Is there a way with jquery validator too make sure one of these are selected, and to refuse the form if the first one is selected.

Anyone have any experience with what I wish to do ?

Thanks in advance !

4

1 回答 1

0

Bootstrap select seems to be using the UL/LI combination to display something nice to the user but is still changing the value of the hidden select box for when it is posted.

What you will need to do is to modify the ignore handler in jQuery Validate, this is set to ignore all hidden fields by default.

I have had to deal with the same problem and written a custom invalid handler that allows you to write exceptions for fields hidden for this reason.

Check out the Validation Docs and find the bit about ignore handlers.

于 2013-10-21T08:50:35.153 回答