3

In MVC we have several forms which can be posted using multiple buttons. We use the button name in our Controller POST Action to check which button has been clicked and which logic to execute.

This works fine! But... in some occasions the submit button is not posted. We see all post data in our exception monitoring system and in these occasions the submit button is not present and the Controller GET Action is executed instead of one of the POST Actions.

Anyone have an idea how this is possible? This occurs using different browsers and different forms, so no logic to be found :(

tereško
  • 58,060
  • 25
  • 98
  • 150
Bjorn H
  • 83
  • 7

1 Answers1

0

Here is a similar question. You should give all your submit buttons sismilar name. For example:

<input type="submit" name="submitButton" value="Send" />
<input type="submit" name="submitButton" value="Cancel" />

So in action you could get sended value by it from collection.

Community
  • 1
  • 1
aleha_84
  • 8,309
  • 2
  • 38
  • 46