Jonas Bush

Blog.blog.blog.blog
posts - 16, comments - 161, trackbacks - 17

My Links

News

Archives

Post Categories

Image Galleries

General

Monday, January 29, 2007

Triggering a validator through javscript

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%>');
ValidatorValidate(myValidator);

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

Hope this helps!

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Posted On Monday, January 29, 2007 3:45 PM | Feedback (1) | Filed Under [ ASP.Net ]

Powered by: