I have a form with two buttons. I check which one is clicked at the server side using the name
attribute of the element in the POST
data and do stuff accordingly:
<input id="reply" name="reply" type="submit" value="{%trans "REPLY"%}">
<input id="delete" name="delete" type="submit" value="{%trans "DELETE"%}">
I'm trying to add a confirmation box (using the Boxy plugin) to the click event of the DELETE
button using JQuery. Here is the code:
$(document).ready(function() {
$("#delete").click(function(e){
Boxy.ask('Delete?', {'1':'YES', '2':'NO'}, function(val){
if (val=='1') $("#form").submit();
});
return false;
});
});
Of course this code results in the form being submitted with the DELETE
button's name absent in the POST
data. Is there a way to add that data to the POST
data or a better way to achieve what I am trying?