Beginform with several button in a form

0

I have form that has several buttons, 1 to delete via aja, 1 to edit via ajax, 1 to open report and I have 1 button for when it is clicked on wish to do the form post, the button of the post works problem is that everyone else is also called the post method.

@using (Html.BeginForm("Create", "Home", FormMethod.Post, new { id ="submitForm" }))
{ 
 <button type="submit" id="btnSave" name="command" value="Save">Save</button>
 <button type="submit" id="btnSubmit" name="command" value="Cancel"/>
}
    
asked by anonymous 16.03.2018 / 02:29

1 answer

0

This happens because you set the type of them as submit change to button, for those you do not want to make the submit form and control your behaviors via javascript.

<button type="button" id="btnSubmit" name="command" value="Cancel"/>
    
19.03.2018 / 15:16