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
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validating beginning number for a data entry

    Anyway to put out an message to validate if a number entered has a zero as a first number?

    So if someone enter the number:
    23
    it would be okay.

    If someone entered:
    60
    it would be okay.

    But if someone entered a number:
    03
    it would give an alert message saying it doesnt like the number beginning with a zero.

    I tried this and it is not working:
    Code:
    var zeroRegEx = /^0/;
    
    if(zeroRegEx.test(document.indexpage.fieldhere.value))
    {
        alert("Do not enter a number beginning with a zero.")
    }

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Don't forget to check here.

    .....Willy

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!


  •  

    Posting Permissions

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