471,573 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,573 software developers and data experts.

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 2119
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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.