W3C home > Mailing lists > Public > www-html@w3.org > March 2005

Question about onsubmit HTML event and submit JS method

From: Rachael Hurd <Rachael.Hurd@cgi-ams.com>
Date: Wed, 23 Mar 2005 01:19:58 +0000
Message-ID: <6F34200C6828D446925E8B615EC7BE0386024E@KITKAT.ams.com>
To: <www-html@w3.org>
Can someone inform me about the background of the onsubmit HTML event
and submit() JS method? Reason I ask is because I notice when the submit
method is executed in JS, the onsubmit HTML event is not executed.  The
following code below was a piece of sample code I created to test this
theory (test-JSsubmit-finish.asp was just a page that contained 'Hello'
on it; nothing really important).


Was this functionality created on purpose by W3C (I'm assuming the
onsubmit HTML event came before the submit() method in JS)? If so, why?


Thank you.


Rachael Hurd





<title>Testing Whether a Submit Event in JS runs the OnSubmit HTML

<script type="text/javascript">


function validateParameters()


    var x = document.forms.item(0).Number1.value;


    if (x != 3)

        {alert('SILLY! ' + x + ' is not equal to 3'); return false;}


        {alert('The number you entered is equal to 3!'); return true;}



function checkBoxAndSubmit()








    <h3>Testing Whether a Submit Event in JS runs the OnSubmit HTML

    <br />

    <form name="form01" id="form01"
action="/Hospital/Tests/test-JSsubmit-finish.asp" method="post"
onsubmit="return validateParameters(4);">

        <input type="checkbox" name="Checkbox1" id="Checkbox1"
onclick="checkBoxAndSubmit();" />

        <input type="text" name="Number1" value="Enter a Number"/>

        <input type="submit" name="SubmitButton" value="Submit">




Received on Wednesday, 23 March 2005 03:13:32 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:06:10 UTC