[thelist] Validating Form for Numeric Data

Luther, Ron Ron.Luther at hp.com
Wed Nov 13 14:33:01 CST 2002


Hi Bob,

I'm just guessing here ... but I think you may still have a
problem with 'partial' numbers.

If your "ImpoundNo" is supposed to be a six digit number like
123456 and a user enters 1234, that number will still pass both
validation checks.

Assuming you have a fixed length number (which you might not)
and that you don't allow leading zeroes (which you might),
you may also need to do this kind of check:

/* Check to make sure it's a six digit number  */

If ((entered_number + 0) < 100000) {
	alert("Enter *ALL* of the number, dummy!")
}
If ((entered_number + 0) > 999999) {
	alert("Whoa dude! Waaaaaay too many numbers there!")
}


HTH,


RonL.
(It's not uncommon for serial numbers, telephone numbers (for a
small area), id numbers, shipment numbers, ss numbers, credit
card numbers, etc. to have a 'fixed' number of places.)

-----Original Message-----
From: Bob Haroche [mailto:spambait at onpointsolutions.com]

Great, thanks to both you and Burhan.



More information about the thelist mailing list