Here is some of the form I have, with 3 submit buttons
<input type="image" name="submit" value="saveasset" class="submit" src="<?=BASE_URL . '/' . IMAGE_URL . '/buttons/btn_save_changes.gif'?>" />
<input type="image" name="submit" value="savetemplate" onclick="saveTemplate(); return false;" class="add_new_link" src="<?=BASE_URL . '/' . IMAGE_URL . '/buttons/btn_new_template.gif'?>"/>
<input type="image" name="submit" value="updatetemplate" onclick="saveTemplate(); return false;" class="add_new_link" src="<?=BASE_URL . '/' . IMAGE_URL . '/buttons/btn_update_template.gif'?>"/>
When I click the first one, it correctly submits ‘saveasset’ to the action function.
When I click the second one, it submits ‘updatetemplate’ to the action function (via AJAX), even though the button clicked is ‘savetemplate’.
When I click the third one, it correctly submits ‘updatetemplate’ to the action function (via AJAX).
This is the saveTemplate() function (uses prototype)
function saveTemplate(){
$('add_asset').request({
onComplete: function (response) {
$('message_inline').show();
$('message_inline').update(response.responseText);
}
});
}
If I only have 2 buttons everything works as I would expect, but I need 3.
You can try passing in a value to your saveTemplate() function, and tell the function to behave differently depending on the value passed in.