Handle Multiple submit buttons in single page

Scenario :

For example, we have a login form with “sign in”,”sign up” and “cancel” button. In this scenario, “sign in” will redirect/do some action,same like sign up and cancel. Lets we discuss how to handle multiple button in same form (calling different action method).

View :

Let we create view with three submit button.

Controller

Here i am going to create three separate action method for signin,signup,cancel for capture the click event in the controller.

Custom ActionNameSelectorAttribute  :

Here we going to implement a custom ActionMethodSelectorAttribute to check which button submitted the form.This contains values posted in the form in a NameValueCollection object.

Note : While clicking the button, MultipleButtonAttribute method will execute first to know which action Mthod to call

OUTPUT :

Multiple submit buttons1

[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]