views:

19

answers:

1

I have a form with multiple submit buttons:

using(Ajax.BeginForm("Submit", "myController", new AjaxOptions { HttpMethod = "Post" }))
{ %>
<button type="submit" name="submitType" value="submit_a">a</button>
<button type="submit" name="submitType" value="submit_b">b</button>
<% } %>

The controller method is as follows:

[Authorize, HandleError, HttpPost]
public ActionResult Submit(string submitType)
{
  //placeholder
}  

With IE (js on or off) the buttons post back with their respective submitType value, however with Chrome and FireFox submitType is null (when js is on, it's fine when js is off)

Does anyone know how I can fix this behaviour please?

(Please note I need to use the Ajax form as it does partial postbacks/updates)

A: 

Crap, the previous developer had placed the BeginForm() tags in invalid places (start of form tag in the middle of a div, end of form tag in an entirely seperate div) and whilst VS didn't throw any errors, it resulted in an invalid markup, which caused FireFox and Chrome to ignore and not return the submit value! Once I corrected the tag positions it started working correctly.

Seb
Since this question is no longer valid, you should be able to delete your question with the link under your question (when logged in).
patridge