I have a form with two buttons, each with onclick = this.form.submit(). I have a hidden field in the form, and I would like the value of the field to be different based on which
Assuming you've got your hidden field setup something like so:
You could just set its value in a common onclick handler for your buttons:
function buttonClick(theButton){ document.getElementById('clicked_button').value = theButton.name; return true; }
And then your submit buttons would be: