Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    55
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Check if there is no alphabets or symbols in a textbox

    is there a way to create some sort of a array that contains all the symbols or alphabets

    e.g
    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 ?

  • #2
    Regular Coder
    Join Date
    Dec 2005
    Posts
    346
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Many different scripts for this on this page.

    http://javascript.internet.com/forms/

  • #3
    New Coder
    Join Date
    Aug 2005
    Location
    Edmonton, Canada
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    if (/\D/.test(textbox.value)) { /// match any non-digit
    alert ("You have entered a character which is not a digit");
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •