无法使用jquery确认对话框提交页面 [英] unable to submit the page using jquery confirm dialog

查看:69
本文介绍了无法使用jquery确认对话框提交页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的观点'



Here is my View'

@using (Html.BeginForm("MultipleCommand", "Student", FormMethod.Post, new { id = "submitForm" }))
{
<span class="alignright">
                                <button type="submit" id="btnSave" name="Command" value="Save" class="btn btn-white btn-info btn-bold">
                                    <i class="ace-icon fa fa-save bigger-120 blue"></i>
                                    Save
                                </button>
<button type="submit" id="btnDelete" name="Command" value="Delete"  class="btn btn-white btn-warning btn-bold">
                                    <i class="ace-icon fa fa-trash-o bigger-120 orange"></i>
                                    Delete
                                </button>
<button type="submit" id="btnCancel" name="Command" value="Cancel" onclick="$('#submitForm').submit()" class="btn btn-white btn-default btn-round">
                                    <i class="ace-icon fa fa-times red2"></i>
                                    Cancel
                                </button>
                            </span>

}
<div id="dialog-confirm" title="Empty the recycle bin?">
    <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
@section Scripts
{
<script src="~/Global/Template/assets/js/date-time/bootstrap-datepicker.js"></script>
<script src="~/Global/Template/assets/js/bootstrap-confirm.js"></script>
<script src="~/Global/Template/assets/js/bootstrap-confirm.min.js"></script>
 <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>  
    <script type="text/javascript">
$(function () {
            $("#btnDelete").on("click", function (e) {
                e.preventDefault();
                $("#dialog-confirm").dialog({
                    resizable: false,
                    height: 140,
                    modal: true,
                    buttons: {
                        "Delete": function () {
                            $("#submitForm").submit();
                        },
                        Cancel: function () {
                            $(this).dialog("close");
                        }
                    }
                });
            });
        });
    </script>







这是我的控制器动作






here is my controller action

public async Task<ActionResult> MultipleCommand(SubmissionViewModel _vmModel, string Command)
        {
            if (!string.IsNullOrEmpty(Command))
            {
                if (Command == Models.BusinessObjects.Common.Command.Save.ToString())
                {
                    return await Save(_vmModel);
                }
                else if (Command == Models.BusinessObjects.Common.Command.SaveAndReturn.ToString())
                {
                    await Save(_vmModel);
                    return RedirectToAction("Index");
                }
                else if (Command == Models.BusinessObjects.Common.Command.Delete.ToString())
                {
                    Repository.DeleteSubmission(_vmModel.Submission.SubmissionId);
                    Repository.Save();
                    return RedirectToAction("Index");
                }
                else if (Command == Models.BusinessObjects.Common.Command.Cancel.ToString())
                {
                    return RedirectToAction("Index");
                }
            }
            else
            {
                
                return await Save(_vmModel, "documents");
            }

            return null;
        }





我无法确认删除并提交表格。它显示空白页。



i am unable to confirm delete and submit the form. It is showing the blank page.

推荐答案

('#submitForm')。submit() class = btn btn-white btn-默认btn-round >
< i class = ace-icon fa fa-times red2 > < / i >
取消
< / button >
< / span >

}
< div id = 对话框确认 title = 清空回收站? >
< p > < span class = ui-icon ui-icon-alert style = 浮动:左;保证金:0 7px 20px 0; > < / span > 这些项目将被永久删除,无法恢复。您确定吗?< / p >
< / div >
@section脚本
{
< script src = 〜/ Global / Template / assets /js/date-time/bootstrap-datepicker.js\"> < < span class =code-keyword> / script >
< script < span class =code-attribute> src = 〜/ Global / Template / assets / js / bootstrap-confirm.js > < / script >
< script src = 〜/ Global / Template / assets / js / bootstrap-confirm.min.js > < / script >
< link rel = stylesheet href = // code .jquery.com / ui / 1.11.4 / themes / smoothness / jquery-ui.css >
< script src = // code.jquery.com/jquery-1.10.2.js\" > < / script >
< <温泉n class =code-leadattribute> script src = // code.jquery.com/ui/1.11.4/jquery-ui.js\"> < / 脚本 >
< script type = text / javascript >
('#submitForm').submit()" class="btn btn-white btn-default btn-round"> <i class="ace-icon fa fa-times red2"></i> Cancel </button> </span> } <div id="dialog-confirm" title="Empty the recycle bin?"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p> </div> @section Scripts { <script src="~/Global/Template/assets/js/date-time/bootstrap-datepicker.js"></script> <script src="~/Global/Template/assets/js/bootstrap-confirm.js"></script> <script src="~/Global/Template/assets/js/bootstrap-confirm.min.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script type="text/javascript">


function (){


#btnDelete)。on( click function (e){
e.preventDefault();
("#btnDelete").on("click", function (e) { e.preventDefault();


这篇关于无法使用jquery确认对话框提交页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆