Posted on: 9/17/2012 3:34:49 AM | Views : 278

I am using some javascript code I found that works well, but it only works if you have 1 validator per control on a form, but in some cases you need 2, then the javascript doesn't work so well.

As you can see here, the Req Fld Validator fires, but since the Reg Ex Validator is after it, the control associated with validation is not changed since the Reg Ex is valid because of no input
<script type="text/javascript"> function WebForm_OnSubmit() { if (typeof (ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) { for (var i in Page_Validators) { try { var control = document.getElementById(Page_Validators[i].controltovalidate); if (!Page_Validators[i].isvalid) { control.className = "error"; } else { control.className = ""; } } catch (e) { } } return false ...

Go to the complete details ...