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
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form validation

    i have problem validating can anyone help please

    <html>
    <head>

    <script type="text/javascript">
    function isEmpty() {
    userData = document.testForm.userInput.value;
    if(userData == null || userData == '') {

    alert("please enter the field");

    }
    }
    </script>
    </head>

    <body>

    <form name="testForm" >

    <p>Name:
    <input type="text" name"userInput" size="30" >

    </p>
    <p>
    <input type="button" name="validateButton" value="Validate" onClick="isEmpty()">

    <p>
    </form>

    </body>
    </html>

  • #2
    New Coder
    Join Date
    Jul 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is a typo on your HTML.

    name"userInput" should be name="userInput".

    Good luck.

  • #3
    New to the CF scene
    Join Date
    Oct 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for that wickford


  •  

    Posting Permissions

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