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: validation

  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    validation

    trying to use regexp against form elements like so...

    function validate ()
    {
    var string = 12345;
    var isAlpha = /^[a-z ]$/;
    if( !isAlpha.document.forms.numbers.value)
    alert (document.forms.numbers.value);
    }

    is this the right approach

    thanx
    Kevin

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    been a while since i've worked with RE's, but, i think it should be:

    function validate ()
    {
    var string = 12345;
    var isAlpha = /^[a-z ]$/;
    if( !isAlpha.test(document.forms.numbers.value))
    alert (document.forms.numbers.value);
    }
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thanx

    I appreciate the help

    thank you
    Kevin


  •  

    Posting Permissions

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