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
Use a button labeled "Submit" to open the dialog:
<div id="dialog" title="Basic dialog">
<p>Please double check to be sure all data is entered correctly.</p>
</div>
<div class="buttons">
<asp:Button ID="btnSave" Text="Save for later" runat="server" OnClick="btnSubmit_Click" ValidationGroup="GroupSave" />
<input type="button" id="preSubmit" value="Submit" />
<asp:Button ID="btnSubmit" class="ui-helper-hidden" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
</div>
Use the Submit
button in the dialog to trigger the click event for your <asp:Button>
.
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;
});
});