i'm trying to send my form data to my ASP MVC controller but the form collection is empty. The variables in the action are bound properly. This is my Razor form
@foreach (var recipe in Model.RecipesInCategory) {
<form name="input" action="mycontroller/myAction/@Model.Id1/@Model.Id2" method="post">
<fieldset>
<table >
<tr>
<td>
<input id="AddBtn" type="submit" value="Add" />
<select id="dayOfWeek" >
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
<option value="Tuesday">Tuesday</option>
<option value="Wednesday">Wednesday</option>
<option value="Thursday">Thursday</option>
<option value="Friday">Friday</option>
<option value="Saturday">Saturday</option>
</select>
</td>
</tr>
</table>
</fieldset>
</form>
}
and here is my controller. The two GUIDs are coming through properly, but the dow variable is always null. In fact, the Form has no entries at all.
[HttpPost]
public ActionResult myAction(Guid Id1, Guid Id2)
{
var dow = this.Request.Form["dayOfWeek"];
Note that i have many forms on this page created in a loop. is that a problem?
The browser will only POST data from form elements with name=""
attributes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With