Apr 10, 2003 #1 Albuckj2 Programmer Jan 7, 2003 68 GB When users input something into a prompt box, how can I stop users entering special characters? i.e. - I only want to allow characters and numbers Thanks, Alex.
When users input something into a prompt box, how can I stop users entering special characters? i.e. - I only want to allow characters and numbers Thanks, Alex.
Apr 10, 2003 #2 EdwardMartinIII Technical User Sep 17, 2002 1,655 US add an onkeyup action to the control. If the last character is not [a..z,A..Z,0..9] then content = content.substring(0,length-1). This is shorty pseudocode, in case it wasn't obvious. Cheers, Edward Like Lovecraft? Know Photoshop? Got time for the Unspeakable? http://www.petting-zoo.org/Movies_Dreamquest.html Upvote 0 Downvote
add an onkeyup action to the control. If the last character is not [a..z,A..Z,0..9] then content = content.substring(0,length-1). This is shorty pseudocode, in case it wasn't obvious. Cheers, Edward Like Lovecraft? Know Photoshop? Got time for the Unspeakable? http://www.petting-zoo.org/Movies_Dreamquest.html
Apr 10, 2003 #3 4345487 Programmer Dec 31, 2002 132 US Here is a sample. <Html> <head><title></title> </head> <BODY> <center> <form> This field will not accept special characters: (like !@#$%^&* etc)<br> <textarea rows=2 cols=20 name=comments onKeypress="if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) event.returnValue = false;"></textarea> <br> </form> </center> </Body> </Html> Upvote 0 Downvote
Here is a sample. <Html> <head><title></title> </head> <BODY> <center> <form> This field will not accept special characters: (like !@#$%^&* etc)<br> <textarea rows=2 cols=20 name=comments onKeypress="if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) event.returnValue = false;"></textarea> <br> </form> </center> </Body> </Html>