The HTML Attribute reference.

"onsubmit" - html Event

  • The onsubmit event occurs when a form is submitted. This is the place where you can do validating of control values before they are transmitted to the server.

Value(s): One or more script statements each ended with a semicolon.

Event "onsubmit" example:
    <form name="carform" action="tryexamples/getFerrari.php"
       onsubmit="if (!='Ferrari')
            { alert('This is not a Ferrari!'); return false;}"
      onreset="'Ferrari'; return false;">
        <legend>Buy a Car:</legend>
        Type : <input type="text" name="car" value="Volvo" /><br />
        Model: <input type="text" name="model" value="2010"/><br />
        Price : <input type="text" name="price" value="$100000"/>
      <button type="submit" >Get Ferrari</button>
      <button type="reset" >Reset form</button>
Used in the element(s):
Elements Description
form This element defines an interactive form.

© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.