Client-Side Control on Validators

 


////// invoke validation for specific validation group
 var res = Page_ClientValidate('ValidationGroup1');

 var rfv = document.getElementById('ValidatorClientId');
 rfv.enabled = true;
 ValidatorUpdateDisplay(rfv);
 ValidatorValidate(document.getElementById('ValidatorClientId'));

Retricting Only Numerics Input Javascript

JavaScript function for ensuring that data being entered by user is numeric only. Call this function onkeypress. If key pressed is other than 0-9 then keypress event will be discarded.

function NumbersOnly(e) {
var unicode = e.charCode ? e.charCode : e.keyCode

//if the key isn't the backspace and TAB key (which we should allow)
if (unicode != 8 && unicode != 9) { 
       if (unicode < 48 || unicode > 57) //if not a number
   {
      return false //disable key press
    }
}

return true;
}

tested in IE7 and FF3.5