I'm using MVC 3 and razor and have a form in which there is a dropdown. How do I submit the form when the value in the dropdown changes? I have no submit button.
@using (Html.BeginForm())
{
...
<div class="row">
<label>
Type of Card</label>
<div class="item">
@Html.DropDownList("PaymentFormModel.CardType", cardTypes, new { required = "required" })
</div>
</div>
...
}
Try like this
@Html.DropDownList("PaymentFormModel.CardType", cardTypes, new { required = "required", @onchange="submitform();" })
Here is the script for it:
function submitform()
{
$('form').submit();
}
hope it helps
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