Ticket #6264 (closed bug: duplicate)
.submit() silently fails if the form has a <input name="submit">
| Reported by: | gnarf | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | event | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
.submit() silently fails if the form has a <input name="submit"> or <input id="submit">
The event trigger function tries caling target[ type ] as a function without first checking to see if it is really a function.
On a form with <input type="submit" name="submit"> form.submit could be the submit button.
If it is, it might be smart to just trigger a "click" on it and hope for the best.
Change History
comment:2 Changed 3 years ago by gnarf
This might be a better solution for when target[type] is not a function:
document.createElement(target.nodeName)[type].apply(target)
comment:3 Changed 3 years ago by dmethvin
This occurs for any element with the name of a form element property (length, action, method, etc.)
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

subscribing for change notification