asp.net mvc 4 - MVC 4 - pass parameter to controller on button click -
i have mvc 4 project has save button when clicked asks user confirm , submits whole form controller model input, not formcollection. need add button form called submit. how can pass parameter differentiate between save , submit? i'd continue using jquery function confirmation. here code snippets:
javascript function saveplan() { if (validateamounts() != true) { var message = "do want save? "; createconfirmationmessage(message, '$("#form_fiscalyearplanning").submit();'); return; } }
jquery
function createconfirmationmessage(message, confirmactiontotake, cancelactiontotake) { $('#project_confirmationquestion').html(message); if (confirmactiontotake !== null) { $('#button_confirmationaccept').attr('onclick', confirmactiontotake); } else { $('#button_confirmationaccept').removeattr('onclick'); } if (cancelactiontotake !== null) { $('#button_confirmationcancel').attr('onclick', cancelactiontotake); } else { $('#button_confirmationcancel').removeattr('onclick'); } $('#modal_confirmation').modal('show'); }/
view
@using (html.beginform("fiscalyearplanning", "teammanagement", formmethod.post, new { id = "form_fiscalyearplanning" }))
:::
<button class="btn btn-primary project_formbuttonpopover" id="button_saveplan" name="button_saveplan" onclick="saveplan();" data-toggle="popover" data-content="save plan, not submit review.">save</button>
controller
public actionresult fiscalyearplanning(vm_fiscalyearplanning model)
the input buttons have value. can detect value of input button @ controller.
<input type="submit" value="submitbutton"> <input type="submit" value="savebutton">
Comments
Post a Comment