SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying display confirm dialog box after submit and do the rest of the process i am using following code but i click confirm nothing is happening.

button :

<asp:linkbutton id="btnSubmit" runat="server" validationgroup="grpContact" cssclass="greyBtn" OnClick="btnSubmit_Click"> Submit</asp:linkbutton>

Jquery:

$(document).ready(function () {
        $("#<%=btnSubmit.ClientID %>").click(function () {
            var validated = Page_ClientValidate('grpContact');
            if (validated) {
                $("#dialog").dialog({
                    buttons: {

                        "Confirm": function () {

                            $("#<%=btnSubmit.ClientID %>").submit();
                            $(this).dialog("close");
                            return true;

                        },
                        "Cancel": function () {
                            $(this).dialog("close");
                            return false;
                        }

                    }
                });
            } return false;
        });
share|improve this question

Try using preventDefault()
Here's an example:

$(document).ready(function () {
            $("#<%=btnSubmit.ClientID %>").on("click", function(e) {
            e.preventDefault();
            var validated = Page_ClientValidate('grpContact');
            if (validated) {
                $("#dialog").dialog({
                    buttons: {

                        "Confirm": function () {

                            $("#<%=btnSubmit.ClientID %>").submit();
                            $(this).dialog("close");
                            return true;

                        },
                        "Cancel": function () {
                            $(this).dialog("close");
                            return false;
                        }

                    }
                });
            } return false;
        });
share|improve this answer
1  
what should be in confirm button – raky Jan 16 '13 at 0:04

Try like this:

    <asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" OnClientClick="return showTermsAndConditions(this);" Style="height: 26px" Text="Submit" ValidationGroup="GrpSubmit" />
var confirmed = false;
    function showTermsAndConditions(obj) {

                $("#dialogTermsAndConditions").dialog({
                    height: 650,
                    width: 800,
                    buttons: {
                        "Yes": function () {
                            $(this).dialog("close");
                            confirmed = true; obj.click();
                        },
                        "No": function () {
                            $(this).dialog("close");
                        }
                    }
                });
                return confirmed;
            }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.