Here is a JS I use to validate only numbers:
function errHandler(txt) {
alert(txt);
}
function checkNum(field) {
var validChars="0123456789";
var temp;
for(i=0; i < field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (validChars.indexOf(temp) == -1) {
field.value='';
field.focus();
errHandler("Numbers are only allowed in this field.");
}
}
}
Then on your form tag <input>
<input type="text" name="firstNumbers" size="7" maxlength="7" value=""
style="text-align: right;" onkeyup="checkNum(this)">
Steven Semrau
SRA International, Inc.
Senior Member, Professional Staff
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Com: (703) 805-1095
DSN: (703) 655-1095
-----Original Message-----
From: paul . [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 10:23 AM
To: CF-Talk
Subject: space in Cfinput problem PLEASE HELP
Hi!
i am using cfinput to get the data for updation!.
and i get only decimal values from the database , my users instead of keying
in values like "1234" leave a blank space and enter like
"1 234"
which gives an error , suggest me and gimme the coding to avoid this
situation , please gimme the coding for an alert! message if they key in
data wrongly
this is my code
-----------------------
<cfinput name="physicians_identified" value="#ident_phys_result#"
type="text" message="Physicians Identified needs to be a number between 0
and 9999" range="0,9999" validate="integer" REQUIRED="Yes">
-----------------------------
this is the error i get when they give the space in between .
---------------
An unexpected token "2" was found following "tier_1_ident_phys=1". Expected
tokens may include: "". SQLSTATE=42601
----------------
Please help
-paul
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists