Geeks With Blogs
Jonas Bush

In this post, I talked about enabling or disabling a validator client-side. Someone had commented asking how to change the status of a control from valid to invalid. The following javascript works at least for required field validators, I haven't tested it with anything else (but I imagine it should work just fine). Again, this is 2.0, I haven't tested this in 1.1:

var myValidator = document.getElementById('<%=reqField.ClientID%>');

For a required field validator at least, the causes the same actions as clicking on a button on the page.

Hope this helps!

Posted on Monday, January 29, 2007 3:45 PM ASP.Net | Back to top

Comments on this post: Triggering a validator through javscript

# re: Triggering a validator through javscript
Requesting Gravatar...
Thanks, this is exactly what I was looking for!
Left by Dave on Dec 03, 2009 7:32 AM

Your comment:
 (will show your gravatar)

Copyright © Jonas Bush | Powered by: