This script allows you to check that a field contains a numeric whole number value.
Choose whether to only allow positive numbers or positive numbers plus zero.
Script Code
Grab a copy of the file below and place it in the same directory as the Web page on which
you will use the script (if you wish to place the script file in a different directory
you will need to make the necessary adjustments to the src attribute of the script tag
that calls it).
You can choose how the viewer should format the number by editing the
num_division variable in the javascript code (instructions in
code comments):
/* Set whether to allow postive, negative or zero.
Use the following values to set:
1 = Allow postive numbers (i.e 1, 15, 534, etc.)
2 = Allow positive numbers and zero (i.e. 0, 14, 235, 01, 0056 etc. )
*/
var num_division = 1;
Accessibility
A backup to the script via a server-side script that validates the number should
suffice (and is highly recommended for security reasons to avoid bad data being passed).