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. Advertisements

  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. Advertisements

  3. Guest

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

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.
Similar Threads
  1. Replies:
    2
    Views:
    6,666
  2. Network-Man
    Replies:
    5
    Views:
    83,962
    gaul1
    Jul 7, 2012
  3. Replies:
    4
    Views:
    1,253
  4. Guest
    Replies:
    2
    Views:
    1,880
    Guest
    Oct 25, 2004
  5. Harry
    Replies:
    3
    Views:
    558
    Harry
    Jan 12, 2006
  6. Megha Vishwanath
    Replies:
    3
    Views:
    1,001
    Megha Vishwanath
    Jul 20, 2004
  7. Replies:
    2
    Views:
    564
  8. Replies:
    3
    Views:
    1,072
Loading...