Is there some easy way to handle multiple submit buttons from the same form? For example:
<% Html.BeginForm(\"MyAction\", \"MyController\", FormMethod.Pos
I've came across this 'problem' as well but found a rather logical solution by adding the name
attribute. I couldn't recall having this problem in other languages.
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
Meaning the following code value
attributes can be changed, localized, internationalized without the need for extra code checking strongly-typed resources files or constants.
<% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %>
<% Html.EndForm(); %>`
On the receiving end you would only need to check if any of your known submit types isn't null
public ActionResult YourAction(YourModel model) {
if(Request["send"] != null) {
// we got a send
}else if(Request["cancel"]) {
// we got a cancel, but would you really want to post data for this?
}else if(Request["draft"]) {
// we got a draft
}
}