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

Reply via email to