这越来越棘手,我无法在 Dailog 框点击中发布到我的表单。对话框一旦打开就在表单外发布,因此在对话框内单击按钮不会将表单提交到服务器。我尝试将对话框附加回表单,但表单会自动发布。当用户单击对话框上的任一按钮时,我只需要发布到表单。提前感谢您的帮助
主视图
@using (Html.BeginForm("Create", "RunLogEntry", FormMethod.Post, new { id = "form", enctype = "multipart/form-data" }))
{
<div id="main">
@Html.Partial("_RunLogEntryPartialView", Model)
</div>
}
局部视图
<button name="submit" class="art-button" type="submit" value="Upload" onclick="test();return false;"
style="width: 100px">
Upload</button>
function test() {
var UploadDialog;
UploadDialog = $("#uploadConfirmation").dialog({
title: "Yes or No",
resizable: false,
modal: false,
buttons: {
"Yes": function () {
$(this).dialog("close");
$("#hiddenInput").val("Normal");
$("#form").submit();
},
"No": function () {
$(this).dialog("close");
$("#hiddenInput").val("Buffer");
}
}
});
// UploadDialog.closest("div.ui-dialog").appendTo("#form");
}