I have a div who's style defaults to "display: none" until a previous field has been filled out, and it contains a drop down list that requires a selection.
If the page is submitted before this div becomes visible, the validation error appears to the left half-off the page.
This is not a functional problem of course, but I've been wondering if there's a way to have the validation engine ignore hidden elements.
So far I've tried class="validate[optional: Special]" as pointed out on the creator's blog: "optional: Special: Only validate when the field is not empty *Please call optional first". It doesn't seem to work as suggested.
<div id="container" style="display: none;">
...
<select id="mapLocation" onchange="moveMapToCenter();" class="validate[optional: Special]" />
...
</div>
I've also tried using jquery.validate "ignore":
$(document).ready(function() {
$("#aspnetForm").validationEngine({
ignore: ":hidden"
success: false,
failure: function() {}
})
});
This may be a simple oversight on my part, we'll see! Thanks.