S
Stanimir Stamenkov
I have a form without a submit button like:
<form name="form1" action=""
onsubmit="alert('submit ' + this.name);">
<div>
<label>Field 1: <input type="text" name="field1"
onchange="alert(this.name + '=' + this.value);"></label></div>
<label>Field 2: <input type="text" name="field2"
onchange="alert(this.name + '=' + this.value);"></label></div>
</form>
The form field 'change' event handlers actually perform AJAX
submission and update some part of the page without "navigating away".
Using the exact form I've given the different browsers behave
differently in handling the default action event (pressing the Enter
key), for example using Mozilla pressing Enter in a field doesn't
cause form submission, but Safari submits the form. I've found
Mozilla submits the form in response to pressing Enter if there's
only one visible field, also:
<form name="form1" action=""
onsubmit="alert('submit ' + this.name);">
<div>
<label>Field 1: <input type="text" name="field1"
onchange="alert(this.name + '=' + this.value);"></label></div>
</form>
Is it possible to detect the form is being submitted in response to
the default action event?
<form name="form1" action=""
onsubmit="alert('submit ' + this.name);">
<div>
<label>Field 1: <input type="text" name="field1"
onchange="alert(this.name + '=' + this.value);"></label></div>
<label>Field 2: <input type="text" name="field2"
onchange="alert(this.name + '=' + this.value);"></label></div>
</form>
The form field 'change' event handlers actually perform AJAX
submission and update some part of the page without "navigating away".
Using the exact form I've given the different browsers behave
differently in handling the default action event (pressing the Enter
key), for example using Mozilla pressing Enter in a field doesn't
cause form submission, but Safari submits the form. I've found
Mozilla submits the form in response to pressing Enter if there's
only one visible field, also:
<form name="form1" action=""
onsubmit="alert('submit ' + this.name);">
<div>
<label>Field 1: <input type="text" name="field1"
onchange="alert(this.name + '=' + this.value);"></label></div>
</form>
Is it possible to detect the form is being submitted in response to
the default action event?