I try to use form submit with jquery modal dialog. Look at following code.
$(function() {
var sendConfirmation = false;
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Send": function() {
sendConfirmation = true;
},
"Close": function() {
$(this).dialog("close");
}
}
});
$("#send").submit(function(event) {
//If user click on modal dialog "Send", then submit should be trigger.
//And if user click "Close"
$(this).trigger("recaptcha");
return false;
/*if(sendConfirmation) {
return true;
} else {
return false;
}*/
});
$("#send").bind("recaptcha", function() {
$( "#dialog-form" ).dialog( "open" );
//return false;
});
});
If the user click on submit button, the dialog will be open and submit should be wait until the "OK" button on modal dialog is clicked, then submit should be execute.
the main idea is, when user click on submit button modal dialog will be open and on the modal dialog is the recaptcha. The user put recaptcha code and click on OK button and data should be submit.