If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Restricting entries for Text Box Prompt

Started by suhas_bhat, 09 Jun 2011 02:22:44 AM

Previous topic - Next topic

suhas_bhat

Hi all,
   Is it possible to restrict entries in a text box prompt.
I want users to be able to enter digits higher than 2 only.
There is a property to set text box prompt to accept only numbers but how do we restrict them to a lower limit.
If there is any way to achieve this through javascript pls share.
Thanks.

Arpitagrawal9

Hi,

You can use the sample code for Adding a javascript alert
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Number validation example</title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <script type="text/javascript">
  function goReturn() {
     getEvent=event.keyCode;
    if(getEvent>=51 && getEvent<=57)
    {
    return true;
    }
     else{
     alert("You did not enter a Valid number!!Please enter a valid number higher than 2!!");
    return false;
    }
   }
  </script>
</head>

<body>
<form name="myform" id="myform">
   Enter any Value: (Numbers only!!)<input type="text" .. onkeypress="return goReturn()">
</form>
</body>
</html>

Hope this helps:)