I have seen multiple issues similar to this saying that unobtrusive was referenced twice and removing one fixed the problem but I have checked and it appears to only be referenced once. When I remove the single reference my form submits once like it should, but I don't get to take advantage of the "inline" functionality that I am trying to take advantage of with unobtrusive.
When I look at my html these are the .js files included, not sure if there is a conflict with another library? I tried removing them one at a time but it didn't seem to fix my issue, only when I remove jquery.unobtrusive-ajax.min.js
does the form submit once, but I need it!
<script src="/assets/js/jquery-1.10.2.js">
<script src="/assets/js/jquery.mask.min.js">
<script src="/assets/js/jquery-ui-1.10.3.custom.min.js">
<script src="/assets/js/jquery.validate.js">
<script src="/assets/js/jquery.validate.unobtrusive.js">
<script src="/assets/js/jquery.unobtrusive-ajax.min.js">
<script src="/assets/js/zCustomAttributeValidation.js">
<script src="/assets/js/nojs.js">
<script src="/assets/js/bootstrap.js">
<script src="/assets/js/respond.js">
<script src="/assets/js/global.js">
<script src="/assets/js/spinner.js">
<script src="/assets/js/toastr.js">
<script src="/assets/js/systemx.js">
<script src="/assets/js/systemx.widgets.js">
Something else that may be of us, this is my form:
@using (noJs ? Html.BeginForm("MyAction", "MyController", new MyModel() { ItemID = myVal, AsyncUpdateID = string.Empty, RawReturnUrl = Request.RawUrl }.GetRouteValues(), FormMethod.Post) : Ajax.BeginForm("MyAction", "MyController", new MyModel() { ItemID = myVal, AsyncUpdateID = string.Empty, RawReturnUrl = Request.RawUrl }.GetRouteValues(), new AjaxOptions() { HttpMethod = "POST", UpdateTargetId = "item-" + myVal.ToString(), OnBegin = "ShowBusyIndicator('item-" + myVal.ToString() + "')" }))
{
@Html.AntiForgeryToken()
<div class="float-left margin-rt-5">
<input id="myButton" type="submit" class="btn btn-default" value="@HttpUtility.HtmlDecode("Submit »")" />
</div>
}
Turns out it was the same problem I am seeing everyone else have. I added unobtrusive twice, I thought because it was only listed in that section of HTML once I hadn't done so but when I took a look at the generated HTML as a whole it was there twice.