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: 401
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" />
}
© Stack Overflow or respective owner