The following code can handle unlimited number of submit buttons passing the ID of the button into a hidden input element.
Mark the clicked button:
$(document).delegate("input:submit, button:submit", 'mousedown', function(e){
$("input:submit, button:submit").removeClass('clicked');
$(this).addClass('clicked');
});
function addClickedSubmitButton($form, $submitBtn){
if( $form && $form.length ){
$submitBtn = $submitBtn || $form.find('.clicked');
if( !$submitBtn.length ) return;
$("<input type='hidden' name='clickedSubmit' />")
.val( $submitBtn.attr('id') )
.appendTo($form);
}
}
In submit handler for the form add the following code:
...
addClickedSubmitButton(
$(this) );
....
return true;
I hope this will help.
Thomas
------