I am trying to understand a problem getting a form to autosubmit in response to an onchange event.
In both versions of the code below, the form should submit automatically if the user selects a new value on the option list or changes the first name. This version works, but does not have a way for the user to submit the form if javascript is not enabled:
[CODE]<html>
<body>
<p>Enter some text in the text fields below, and then press the “Submit” button to submit the form.</p>
<form id=”myForm” action=”somepage.php” method=”post”>
Firstname: <input type=”text” name=”firstname” size=”20″ onchange=”this.form.submit()”><br />
Lastname: <input type=”text” name=”lastname” size=”20″><br />
<select id=”email” onChange=”this.form.submit()”><option value=”1″>1</option><option value=”2″>2</option></select>
</form>
</body>
But this version only submits when the user clicks the submit button. The only difference is the addition of the submit button:
[CODE]<html>
<body>
<p>Enter some text in the text fields below, and then press the “Submit” button to submit the form.</p>
<form id=”myForm” action=”somepage.php” method=”post”>
Firstname: <input type=”text” name=”firstname” size=”20″ onchange=”this.form.submit()”><br />
Lastname: <input type=”text” name=”lastname” size=”20″><br />
<select id=”email” onChange=”this.form.submit()”><option value=”1″>1</option><option value=”2″>2</option></select>
<input id=”submit” type=”submit” name=”submit” value=”Submit”></form>
</body>
What am I doing wrong in the second example?