Beginner question: form submit

Discussion in 'Javascript' started by soup_or_power@yahoo.com, Jun 6, 2005.

  1. Guest

    My form looks as follows. Why isn't the function Validate called when
    the function test is called? Thanks for your help!!

    function Validate()
    {
    alert("in validate");
    }

    function test()
    {
    //do something
    document.forms[0].submit;
    }
    <FORM method="POST" onsubmit="return Validate()">
    ....
    <input type=text value="xyz" onclick="test()">
    </FORM>
     
    , Jun 6, 2005
    #1
    1. Advertising

  2. LV_Indy Guest

    Because you aren't calling submit as a function:

    document.forms[0].submit();

    You are basically asking if submit exists, which is does. But you are
    doing nothing with it, so nothing's happening.
     
    LV_Indy, Jun 6, 2005
    #2
    1. Advertising

  3. Guest

    The lack of paranetheses was my typo. Thanks for your reply.
     
    , Jun 6, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page