469,268 Members | 961 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

Check for Valid characters in a string

37
I'm looking ASP code to validate certain characters that are contained in a string - for example, when a user enters a username or password, I want to limit the characters to a..z, A..Z,0..9, _, -, only. What's the best way to check for this?

Thanks...
Jan 30 '07 #1
3 2046
shweta123
692 Expert 512MB
Hi,

Check the ascii code for the characters on the keypress of textbox
using javascript
document.form1.textbox1.value.charCodeAt(index)
Jan 30 '07 #2
ozzii
37
Does anybody have any ASP code to do this?
Jan 30 '07 #3
jhardman
3,406 Expert 2GB
I've tried it before, but it took a lot of code, and the best it could do was remove the offending characters or go back to the form for re-entry. I just used a series of instr() commands.

I agree with (above) though, it's easier in javascript
Jan 31 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

By using this site, you agree to our Privacy Policy and Terms of Use.