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
use Prototype :-)
But in all seriousness:
id
to the hidden fieldBefore you submit the form in each handler:
document.getElementById("hiddenId").value = "mySpecialValue";
//or (depending on which onclick handler you are in)
document.getElementById("hiddenId").value = "myOtherSpecialValue";
Submit the form the same way you are now.
Recommended ex:
...
function buttonA_clickHandler(event) {
document.getElementById('hiddenId').value = whatever;
document.getElementById('theForm').submit();
}
repeat for the other button.