Ok. I've seen this question as been unanswered for over 10 years..
How do you submit and close a popup in one button call.
suggestions run thus.
function saveNClose()
{
document.form.submit();
self.close();
}
this doesn't work because the submit has a redirect, and the self.close is never reached.
function closeLaterNSaveNow();
{
setTimeout("window.close()",5000);
document.form.submit();
}
same problem.. the close is never called because the script for the page is gone.
function closeNowNSubmit()
{
self.close();
document.form.submit();
}
the window closes, but nothing gets saved. server doesn't even get notified of anything..
<input class='btn btn-success' disabled='disabled' id='SubmitFinal' onclick='closeWindow()' type='submit' value='Finish'>
Well then there's no validation of the data. it submits before the function is called.
Anyone solve this? I found the same solutions dating back to 2002, and some as recent as this month. I shall continue to look, but I'm hoping someone has nailed it and that that someone answers here
close() script. This will close the pop up window.
In the Form Settings->On Submit->Redirect URL set this value : javascript:window. top. close();
You can use a link: <a href="#" onClick="CloseAndRefresh(); return:false;">Close</a> Or a button: <input type="button" value="close" onClick="CloseAndRefresh();" Or you can make it part of the submit: <input …
A typical solution is to output a JS snippet that will close the window as a resulting page after submit.
<script type="text/javascript">
window.close();
</script>
Another solution would be to submit form's data via AJAX, and close the window when request has finished. You can use jQuery Form plugin for that:
$("#myForm").ajaxForm(function() {
window.close();
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With