Is there a reason you can just use the onsubmit event? <form id="blah" action="blah" onsubmit="canSubmit(this)">
something like that cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: stretch <clive.wick...@gmail.com> To: "jQuery (English)" <jquery-en@googlegroups.com> Date: 02/16/2009 02:15 PM Subject: [jQuery] Pass form as argument into its submit event What I'm trying to do should be very simple. I would like to assign a submit handler to a form and pass that form into the handler (I then wish to interrogate the id of the form argument and perform appropriate validation according to which form it is). The following code doesn't achieve the desired result. Inside the canSubmit function, according to firebug, the form argument seems to be of type form#[object HTMLInputElement] and form.id is undefined. // in domready event handler $('form').submit(function() { return canSubmit(this); }); ... function canSubmit(form) { switch(form.id) { case "enhancementForm": ... case "newitemForm": ... } return true; } Any pointers would be much appreciated. Clive
<<inline: graycol.gif>>
<<inline: ecblank.gif>>