我在从JS进行验证后尝试提交表单,我在.submit
行的开发者模式成员Not Found中收到错误。
这是我宣布表格的方式:
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "spc_form" }))
@Html.AntiForgeryToken()
这是代码:
<input type="button" value="Submit" class="btn btn-warning" id="submit" />
<input type="button" value="Save" class="btn btn-warning" id="save" />
$('#save').click(function () {
var validated = 1;
//input black borders here
if ($('#multi_project_name_0').val() == "" || $('#multi_project_name_0').val() == " ") {
$('#multi_project_name_0').css("border-color", "red");
validated = 0;
}
var x = document.getElementById("multi_pj_class").getElementsByTagName("tr").length;
if (validated == 1) {
if (document.getElementById("multi_sop").value == "" || document.getElementById("multi_sop").value == " ") {
document.getElementById("multi_sop").value = document.getElementById("this_date").value;
}
if (document.getElementById("multi_start_pj").value == "" || document.getElementById("multi_start_pj").value == " ") {
document.getElementById("multi_start_pj").value = document.getElementById("this_date").value;
}
if (document.getElementById("multi_date_evaluation").value == "" || document.getElementById("multi_date_evaluation").value == " ") {
document.getElementById("multi_date_evaluation").value = document.getElementById("this_date").value;
}
for (var i = 1; i < x - 1; i++) {
if (document.getElementById("multi_sop_" + i).value == "" || document.getElementById("multi_sop_" + i).value == " ") {
document.getElementById("multi_sop_" + i).value = document.getElementById("this_date").value;
}
if (document.getElementById("multi_start_pj_" + i).value == "" || document.getElementById("multi_start_pj_" + i).value == " ") {
document.getElementById("multi_start_pj_" + i).value = document.getElementById("this_date").value;
}
}
document.getElementById("active").value = "2";
document.getElementById("spc_form").submit(); <------ THIS IS WHERE THE PROBLEM IS
}
else {
alert("You must complete the first Project Name field in order to save the project.");
topFunction();
}
});
</script>
<!-------------------------------------->