Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

resetClientSideValidations for a specific field only? #424

Closed
stevenringo opened this Issue Oct 30, 2012 · 4 comments

Comments

Projects
None yet
4 participants

Hi,

We have a form that has an "optional" section. For example a checked checkbox might indicate that additional information must be filled in.

I can toggle the validations in the optional section using enableClientSideValidations() and disableClientSideValidations() respectively, however if the checkbox is later unchecked I would like to clear the messages etc already shown. I tried using resetClientSideValidations(), but this seems to work only on the entire form, not at a field level.

Any idea on how to do this, short of adjusting the error message css manually?

Thanks!

Steve

Contributor

bcardarella commented Oct 30, 2012

There is no per-input validation reset function. But you could get what you want by doing:

$(input).disableClientSideValidations();
$(form)[0].ClientSideValidations.removeError($(input));

Works! Thank you :-)

For anyone copy/pasting @bcardarella's lines above - there's a typo.

Should read:

$(input).disableClientSideValidations();
$(form)[0].ClientSideValidations.removeError($(input));
Contributor

tagliala commented Apr 4, 2016

@weavermedia thanks, comment updated fwiw 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment