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 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; …
Jump to PostI would recommend using both, just as a safe guard for some reason that a user can input something that wasn't typed.
But at a minimum, you should always use server-side validation.
All 5 Replies
serkan sendur 821 Postaholic Banned Featured Poster
SheSaidImaPregy 28 Veteran Poster
ebabes 0 Junior Poster in Training
serkan sendur 821 Postaholic Banned Featured Poster
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.