views:

102

answers:

3

HI guys,

is there any way to find which control is submitting the form through JavaScript??

also if one defined a JavaScript function to be called on the form submit event is there a way to find the control which caused the submission

Thanks a lot

A: 

on the server side if you have this you can see all infromation which user submit on the page include control

anatoly
A: 

On the client side?

With firebug you can.

You would have to overwrite the onsubmit event with : console.trace

So you would have to enter document.getElementById("FORMID").onsubmit=console.trace

Ghommey
+1  A: 

As far as I know, this can only be achieved by adding an event handler to each submit button. For example:

function () {
  this.form.submission_trigger = this;
};
David Dorward
could you please elaborate??? submission_trigger is a variable ???
Pankaj Kumar
this is the element firing the event, form is the form to which that form control belongs, submission_trigger is an arbitrary property of that form which you create. You can then read it in the form's submit event handler.
David Dorward