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 3 of 3

Thread: form validation

  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts

    form validation

    i would like to perform a form validation so the user cannot enter \t (tab horyz) (space bar) is it possible to do without regular expressions,i got someting like this this:
    Code:
    if(document.form1.nom.value.length==0 || document.form1.nom.value=='\x00' ){
        errmsg3();
         return false;
       }
    the \x00 value is what represents \t in hexadecimal i think, so i am tryng to do the validation this way but does not work.

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Have you tried on checking for whitespace instead:
    Code:
    if(document.form1.nom.value.length==0 || document.form1.nom.value=='' ){
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    399
    Thanks
    33
    Thanked 7 Times in 7 Posts
    hello,

    yes i tried that and does not work , i will have to do some classic trim function with regex.I was hoping my approach could work..


  •  

    Posting Permissions

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