Welcome to Redline spacer spacer
Check a Field for an Integer Value
bar Sep 26, 2020
bar Home
bar Downloads
bar Privacy
bar Site Map
bar Search

Home > Toys > Here
spacer In this document there is a JavaScript program that you may want to use to help out the new users of your applications.

This JavaScript program is utilized to validate that a numeric field is either numeric and (optionally) is within a specific numeric range. When data is changed in any field so coded, CKint() is called to see if the data is first and foremost a number. If it fails that, a JavaScript 'alert()' box pops up to indicate the error. If the entered data is actually a number, and the call to CKint() specifies a range, the number entered is compared to the range. If the entered number is outside the range, then a JavaScript 'alert()' box pops up to inform the user of this error.

Special Coding Issues

When you look at the source to this document, look over the <input ...> tags for the 'isnumeric' and 'isrange' input fields below. Each has a JavaScript 'onChange=' event handler that is specific to the given input field. The first argument to CKint() is always 'this.value'. If you do not want range checking to occur, simply set the second and third values to '0'. If you do want range checking, the second value is the minimum value, the third is the maximum.

Enter a number
Enter a number between 1 and 100
Fight Spam! Join CAUCE!
In Assoication with Half.Com, an eBay company
In Association with Amazon.com

frame bar
spacer Creative Commons License
The website "Redline" by Roland J. Stolfa is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License.
  [Home]    [Downloads]    [Downsizing]    [Writings]    [Crafts]    [Living]    [Family]    [Toys]    [Cryptography]    [Fun Links]    [Site Credits]    [Personal Info]    [Privacy]    [Site Map]    [Search]    [Email Me]