How will you know whether the input entered by a user in a textbox is alphanumeric, number, or string? I request a user to enter a number in a textbox and I wish to trap those users entering alphanumeric or strings. How can I do this?
ebabes
0
Junior Poster in Training
Recommended Answers
Jump to Postyou can use javascript to validate input in your textbox :
add this script to head section of your page<SCRIPT language="JavaScript"> <!-- function IsNumeric(strString) // check for valid numeric strings { var strValidChars = "0123456789.-"; var strChar; var blnResult = true; if (strString.length == 0) return …
Jump to PostOr you can just automatically make it so your user cannot type in anything but integers, or alphanumeric code, or even whatever else. Something like this would be:
<script language="javascript"> function onlyInts(objEvent) { ikeyCode = objEvent.keyCode; if (ikeyCode >= 48 && ikeyCode <= 57) { return true; …
All 5 Replies
serkan sendur
821
Postaholic
Banned
SheSaidImaPregy
28
Veteran Poster
ebabes
0
Junior Poster in Training
serkan sendur
821
Postaholic
Banned
SheSaidImaPregy
28
Veteran Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.