I have an ASP .NET MVC 3 project and a problem with one of my 'Create' views.
I have cascading drop-down fields that I have implemented with ajax forms.
The view is roughly speaking - like this:
@using (Html.BeginForm(...))
{
@Html.MyDropDown1
using (Ajax.BeginForm(...))
{
@Ajax.MyDropdown2
<input type="submit" value="Select" />
}
using (Ajax.BeginForm(...))
{
@Ajax.MyDropdown3
<input type="submit" value="Select" />
}
<!-- other form fields -->
<input type="submit" value="Create" />
}
The problem is that the submit buttons inside the ajax forms actually submit the outer html form.
Is there any way to specify the name of the form I want to submit?
I thought about putting my ajax forms above my html form so there would not be any nesting - but I need the values of the drop-down's selected items in my html post.
Thanks, Pete
As pointed out in comments you can't have nested forms. Remove all the using (Ajax.BeginForm(...))
bits, and handle your ajax calls through jQuery (or sth else).
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