Link to home
Start Free TrialLog in
Avatar of JCWEBHOST
JCWEBHOST

asked on

javascript

hey guys, i need a javascript to for validating integer number in a textbox or the pattern for rex editor?


here is one for decimal

function DecimalValidator(source, args)
{  
    var Value = document.getElementById(source.controltovalidate).value;  
    var pattern = /^\d+(\.\d{1,2})?$/  
 
     if (!pattern.test(Value))  
      {
            args.IsValid =false;
            document.getElementById(source.controltovalidate).className=  "errorbox";
           
        }
        else
        {
            args.IsValid = true;
            document.getElementById(source.controltovalidate).className='correctbox';
        }
}  
ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
function isNumeric(string)
{
   if ( parseInt(string) != null && parseInt(string) != undefined )
  {
     return true;
   }
     return false;
}
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial