Event listener for a form being submitted is not catching an A tag
with a submit in it.
Example JS:
$(form).observe('submit', function(e) {
e.stop();
// Something
});
Example HTML:
<a href="#" onClick="myForm.submit();">Submit form</a>
Any idea how to fix this without added more js to button?
on 2008-06-18 22:31
on 2008-06-18 23:02
Calling aForm.submit() does not get observed by any listeners. Observe will listen to the user generated event - a button or img tag, or pressing return in a text box - but not to a submit() call. Try observing for click and submit and stop/forward to a 3rd function that handles the logic, or have both fire a user event. -Fred On Wed, Jun 18, 2008 at 3:30 PM, louis w <louiswalch@gmail.com> wrote: > > Example HTML: > > <a href="#" onClick="myForm.submit();">Submit form</a> > > Any idea how to fix this without added more js to button? -- Science answers questions; philosophy questions answers.