Tuesday, August 18, 2015

Only enable RequiredFieldValidator when parent element is visible?

I agree that a custom validator would be best, but if you do need to do it on the client side, you can use the ValidatorEnable function.

ValidatorEnable(document.getElementById("<%= RequiredFieldValidator.ClientID %>"), false);

(Note that I have never actually tried this myself, but I have heard of it successfully being used to disable validators on the client side.)

Solution: http://stackoverflow.com/questions/15254210/only-enable-requiredfieldvalidator-when-parent-element-is-visible