using jquery ui modal dialog to submit a form

后端 未结 1 995
别跟我提以往
别跟我提以往 2021-01-14 06:19

I am having difficulty using JQuery UI Modal Dialog when submitting a form. The intent is you hit the submit button, the modal pop ups and depending on your selection from t

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-14 07:01

    Use a button labeled "Submit" to open the dialog:

    Please double check to be sure all data is entered correctly.

    Use the Submit button in the dialog to trigger the click event for your .

    function submitForm() {
        $('input#<%=btnSubmit.ClientID %>').click();
    }
    function checkSubmit() {
        $("#dialog").dialog({
            "modal": true,
            "buttons": {
                "Submit": function() {
                    submitForm();
                },
                "Go Back": function() {
                    $(this).dialog("close");
                }
            }
        });
    }
    $(document).ready(function() {
        $('button#preSubmit').click(function(e) {
            checkSubmit();
            e.preventDefault();
            return false;
        });
        $('button#saveForLater').click(function(e) {
            $("#dialog").dialog('close');
            e.preventDefault();
            return false;
        });
    });​
    

    0 讨论(0)
提交回复
热议问题