I have read many articles explaining how to handle 2 submit buttons in a form but none of them have worked for me.
form:
<form id="myForm">
<input type="submit" name="btngroup" value="remove" />
<input type="submit" name="btngroup" value="activate" />
</form>
js:
$('#myForm').submit(function (e) {
e.preventDefault();
var form = $(this);
$.ajax({
url: '/Admin/removeDocPermanently',
type: 'POST',
DataType: "html",
data: form.serialize()
});
});
controller
[HttpPost]
public ActionResult removeDocPermanently(string btngroup, FormCollection form)
{
//btngroup does not get the value of the clicked submit button
}
Is this possible to get the pressed submit button in the js submit function or the controller?