Html.BeginForm Deploy HttpGet action, not HttpPost in IE, great in Chrome and Firefox

In the Shaver view, I have the following:

@using (Html.BeginForm("Edit", "MyController", FormMethod.Post)) { <div class="grid_1">&nbsp;</div> <div id="ValSummary"> @Html.ValidationSummary(false)</div> @Html.EditorFor(x => x.Role, MVC.Shared.Views.EditorTemplates.KeyValuePairSelectList, new { SelectListOptions = Model.RoleSelectList })<br /><br /> @Html.EditorFor(x => x.Trust, MVC.Shared.Views.EditorTemplates.KeyValuePairSelectList, new { SelectListOptions = Model.TrustSelectList.OrderBy(x => x.Text) })<br /><br /> @Html.EditorFor(x => x.GmcCode)<br /><br /> <div class="createbutton"> <input id="btnGoBack" type="button" value="Back"/> <input id="btnSubmit" type="button" value="Submit" /> </div> } 

In my controller I have

 [HttpGet] public virtual ActionResult Edit(string id) { } [HttpPost] public virtual ActionResult Edit(ViewModel viewModel) { } 

In Firefox and Chrome, everything works fine, but in IE, when the form is submitted, the HttpGet action is triggered, not HttpPost.

There are no hints in the call stack or in the IE developer tool console.

Anything obvious I'm missing?

+4
source share
1 answer

The submit button should represent the real submit button using type="Submit"

 <input id="btnSubmit" type="submit" value="Submit" /> 

to submit the form correctly in all browsers.

See this SO question for further differences: Difference between <input type = 'button' /> and <input type = 'submit' />

+5
source

All Articles