views:

10

answers:

1

I'm using jsvalidate and I want to require some fields only when the user selects a yes (Sí) on my form here: alt text

A required validation field on jsvalidate is implemented writing class="jsquerired" on the select element. How can I make class="jsquerired" appear if the user clicks "Sí" on my select?

Example:<input class="jsrequired jsvalidate_email texto" name="emailRecomendado" type="text" size="30"/>

+1  A: 

It doesn't seem jsvalidate comes with conditional validation out of the box, so you will probably have to come up with a custom validation class for those fields that checks if "yes" was selected -- and if it was, return true (validation passed) if the field is not empty.

CD Sanchez