tags:

views:

15

answers:

1

In my MVC application, I've got a page where I use a few hidden fields to make some calculations under the hood. This page is loaded with xVal validations to make the data coherent. But the problem is that the xVal is also validating the hidden fields which are only used at the page itself. Is there any way of disabling xVal for hidden fields?

+1  A: 

One way is to disable the fields, jquery validation will then ignore them.

redsquare
But in case I disable the fields, I can no longer use them for calculations. I tried wrapping a span around the hidden fields with the class ignored and doing the following but it didn't stop xVal. $('table.detail').validate({ ignore: ".ignored" });
Hallaghan
Is this client side? You can still get/set the values in hidden disabled, however they wont be posted to the server - you could enable them on submit.
redsquare
Really? So all I have to do is iterate through them with .each and disable and I'll still get them client side? That's awesome! I'll test it out in a second.
Hallaghan
Thanks, worked like a charm.
Hallaghan