Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3

Thread: weird form

  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    validate form

    now this has had my head spinning for ages..

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Test form validater</title>
    <script language="JavaScript">
    function checkform()
    {
    var nameUser = document.form1.name_user.value;
    
    if (nameUser ="" || value<3)	{
    alert("OI NO");
    return true;
    }
    }
    </script>
    </head>
    
    <body>
    <form name="form1" method="post" action="" onSubmit="checkform()">
      <p>
        <input type="text" name="name_user">
      </p>
      <p> 
        <input type="submit" name="Submit" value="Submit">
        <input type="reset" name="Submit2" value="Reset">
      </p>
    </form>
    </body>
    </html>
    I'm practicing my JavaScript and well that isnt working cud some1 explain how i should correct it and why its not working

    thanks..
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    lol i missed the r on the thread name ah well lol weid form it is :-D
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Fixed the title.

    Try this in your function:
    Code:
    function checkform() {
        if (document.forms['form1'].inputs['name_user'].value.length() < 3) {
            alert("OI NO");
            return true;
        }
    }


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:01 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com