Submit not working when preventdefault() being used

Submit not working when preventdefault() being used

Hi, I have a form with two buttons on it of type "submit". The two buttons look as follows:

< input id ="UpdateButton" value ="Update" type ="submit" name ="action:Update" onclick ="return performUpdate(); " class ="btn btn-block btn-primary user-action" />

< input type ="submit" value ="Save" class ="btn btn-block btn-primary user-action" name ="action:Save" id ="SaveButton" />

Note the "name" attributes. 

When the update button is clicked the code for updating the data is fired in the controller (application is an MVC app) because of the value for the name attribute.

When the submit button is clicked a dialog needs to display with an OK button. Once the OK button is clicked the form data is saved because of the value of it's name attribute.

What I have is as follows:  

$('#InputForm').submit(function (e) {
        // Check if your user action requirement has been met
        if (navParams.userAction) {
            // Action is required, so cancel the submission
            e.preventDefault();
            navParams.isDirty = false;

            displaySavePromptMessage();
            return false;
        }              
        // Otherwise submit as normal
    });

function displaySavePromptMessage() {
        if (isModalOpen == false) {
            bootbox.dialog({
                closeButton: false,
                title: "",
                message: "<strong>Warning: </strong>Changes have been made , ensure corresponding dates have been updated on the  screen",
                buttons: {
                    success: {
                        label: "Ok",
                        callback: function () {
                           
                            navParams.userAction = false;
                            $('#InputForm').submit();
                          }
                    }
                }

            });
        }
    }

When the Save button is clicked the dialog displays, I click OK, the dialog closes but the data isn't saved. When I look at the request body in the browser's dev tools for when the update button is clicked it looks like this:

...& DisableReports = False & action % 3AUpdate = Update

It's obviously longer but if you notice at the end the action%3AUpdate=Update?

And prior to the above changes, when the save button was clicked the request body looked like this:

...& DisableReports = False & action % 3ASave = Save

But after I applied the above changes the request body does not change from ...& DisableReports = False & action % 3AUpdate = Update therefore the code in the controller that is doing the saving is not executing. Looks like this:

[ HttpPost ]

[ MultiButtonAction (Name = "action" , Argument = "Save" )]

public async Task < ActionResult > Save( ViewModel viewModel)

{...

Any suggestions?




{