Faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

130 of 163 people (80%) answered Yes
Recently 10 of 10 people (100%) answered Yes


Why does form.submit() not fire the OnSubmit event handler referenced within the <FORM> tag?

Apr 16th, 2003 07:25
Leonardo Bueno, John Chajecki, sigal calderon,

Because the browser you've been testing on doesn't implements the
standard behaviour defined by w3c:
The HTML DOM Level 2 standard says calling submits() must perform the
same action of a submit button.
To workaround this problem you can use some code like this:
<input type="submit" name="fakeSubmitButton" style="display: none"/>
instead of calling document.forms['form name'].submit(); call
document.forms['form name'].fakeSubmitButton.click();