Ajax.BeginForm is submitting disabled form elements

Posted by Fiffe on Stack Overflow See other posts from Stack Overflow or by Fiffe
Published on 2012-07-10T13:34:27Z Indexed on 2012/07/10 15:16 UTC
Read the original article Hit count: 404

Filed under:
|
|
|
|

Using MVC3 and Ajax.BeginForm I surprisingly discovered that mvc ajax forms submits elements with the attribute disabled="disabled".

I have tested both select and text inputs.

I was suprised because they should not be submited and they will not when using Html.BeginForm.

Is there some hidden option or a workaround for this?

[EDIT example]

 @using (Ajax.BeginForm("Action", "Control", new AjaxOptions() { HttpMethod = "POST" }))
{

  <input type="text" name="_enabled" value="_enabled" />
  <input type="text" name="_disabled" value="_disabled" disabled="disabled" />

  <input type="submit" value="POST" />

}

Posted data

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about asp.net-mvc-3