当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Jquery Form submit will not reach MVC Controller

问题描述:

Note: Tested on Firefox and IE 11

I'm encountering a very weird issue here that doesn't seem to affect every account we have for testing. We have a Login form and once the user is logged in he can update the profile (which is part of the code you see below).

One account works perfectly fine, the submit button is clicked and it reaches the JS onclick event I'm displaying below, it then lands on the controller as expected.

Now, two other accounts, with similar data (nothing too different) submit the form and the click event fires but once it submits the form, it never reaches the controller.

Any ideas on what can be causing this?

JS File (Trimmed for simplicity)

//All arguments coming in are true

if (isValidGeneral && isValidAgentTypes && isValidAgentCodes && isValidCountrySelect && isValidTitleSelect && phoneNumbersValid ) {

obj.preventDefault();

$('#ProfileUpdateForm').submit();

return false;

}

HTML

@using (Html.BeginForm("AgentProfileUpdate", "AgentProfile", FormMethod.Post, new { enctype = "multipart/form-data", id = "ProfileUpdateForm" }))

{

@Html.ValidationSummary(true, "Profile update failed")

<div>

<fieldset> ....Lots Of Fields... </fieldset>

</div>

<div id="submitButtonsDiv">

<input id="btnSubmit" type="submit" value="UPDATE" class="btnProfileUpdateSubmit" tabindex="56" />

<input type="button" value="CANCEL" class="btnProfileUpdateCancel" tabindex="57" onclick="document.location.href=document.referrer" />

</div>

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: