我一直在搜索互联网(包括 SO),我找不到任何可以帮助我解决我的情况的东西,所以希望我能从你们那里得到一些帮助。
基本上,就像标题所说的那样, .submit() 不会在 IE 中触发。所有其他浏览器都可以正常工作,但在 IE 中(目前有 8、9、10 个)它只是不会触发提交。
这是视图代码:
<form id="@formId" method="post" enctype="multipart/form-data" action="@Url.Content("/ActivityEvent/SubmitCheckpointApproval")">
<table id="checkpoint-approval" style="width:100%" align="center" class="noBorders">
<tr>
<td style="width: 520px;">
<div>
Please enter any relevant comments:
</div>
<div style="margin: 10px 0;">
<textarea class="wysiwygSimple" rows="4" cols="60" name="comment" id="checkpoint-comment-@(actTplId)"></textarea>
</div>
</td>
<td style="border: 0; padding-top: 30px; text-align: center; width:70px;">
<img alt="key" src="/Content/Images/checkmarkInCircle.png" align="middle" style="width: 100px;
height: 100px;" /><br />
<p style="text-align: left; margin-top: 10px;">
The notes and resources entered here are shared with the student.</p>
</td>
</tr>
<tr>
<td colspan="2" class="ResourcesUploadList">
Suggest some resources:<br />
<div style="float: left;">
<input class="Multi" type="file" name="resourceFiles[]" /></div>
<div style="float: left; margin-left: 10px; font-style: italic;">
(click browse for each file you want to upload)</div>
<div style="clear: both;">
</div>
</td>
</tr>
<tr>
<td style="border: 0; text-align: center; width:600px;" colspan="2">
@if (hasAdminRights)
{
<input type="button" @Html.Raw(btnStyle) class="activityApprove" name="actionApprove" id="actionApprove" value="Tutor Completion Approval" title = "Approves all activities preceding this checkpoint as complete." onclick="Activity.submitCheckpointApproval('@(formId)', '@(ActivityEvent.EVENT_TYPE_APPROVED)',@(actTplId));" />
<input type="button" @Html.Raw(btnStyle) class="activityAttention" name="actionAttention" id="actionAttention" value="Needs Attention" title = "Notifies the student that this project needs additional work prior to completion." onclick="Activity.submitCheckpointApproval('@(formId)', '@(ActivityEvent.EVENT_TYPE_NEEDS_ATTENTION)',@(actTplId));" />
}
<input type="button" @Html.Raw(btnStyle) value="Cancel" title = "Close this." onclick="javascript:$('#checkpoint-approval@(actTplId)').toggle();" />
</td>
</tr>
</table>
</form>
单击按钮时:
Activity = {
submitCheckpointApproval: function (formId, activityEventStatusId, activityTemplateId) {
var resultsDivId = $("#checkpointResults" + activityTemplateId);
Activity.showCheckpointLoading(resultsDivId); //Just shows a spinner for loading
$("#checkpoint-activityEventStatusId-" + activityTemplateId).val(activityEventStatusId);
$("#" + formId).submit(); //PROBLEM IS HERE??
},
...
};
最后,控制器:
[HttpPost]
[ValidateInput(false)]
public ActionResult SubmitCheckpointApproval()
//Save everything in here
}
在 IE 中调试时,我进入 js 中的 .submit() 行,然后从那里运行它。在此之前的一切工作都很好,但随后 .submit() 来了,它停止做任何事情。没有 javascript 错误,控制台中没有任何内容,根本没有任何问题的迹象。在所有其他浏览器中, .submit() 触发得很好,控制器会中断被调用的方法。
关于为什么在 IE 中发生这种情况的任何想法?我敢肯定有人以前遇到过这个!请帮忙,我整个下午都在把头从桌子上敲下来!
多谢你们!