View Full Version : Check if there is no alphabets or symbols in a textbox

07-27-2006, 09:47 PM
is there a way to create some sort of a array that contains all the symbols or alphabets

a = a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,`,,!,",,$,%,^,&,*,(,),_,-,+,=,[,],{,},;,:,',@,#,~,,,.,<,>,/,?,|,\

if textbox==a then show some kind of alert message

can this be done ?

07-27-2006, 10:03 PM
Many different scripts for this on this page.


07-27-2006, 10:05 PM
What about restricting the types of characters that can be inputted. ie... if you tried to type an invalid character it just wouldn't let you. I haven't done this before, but it's just a theory, shouldn't be too hard to find some examples on Google.

Philip M
07-28-2006, 08:46 AM
if (/\D/.test(textbox.value)) { /// match any non-digit
alert ("You have entered a character which is not a digit");