Want to close popup window after form submit


Want to close popup window after form submit



I want to close child popup window after form submit and go to parent window where this child window fire and refresh this parent window.



Parent window code(where i want to open popup window)


function selectParticipants(id) {
window.open('<?php echo base_url(); ?>
trainings/get_paticipant_list/' + id, 'popup', 'width=1000,height=600');
}



here i open a child window.



popup window code(where i submit form data then close this window at a time)


<form method="post" name="participant_form" action ="<?php echo base_url();?>trainings/add_participant/" onsubmit="Setvalues();">
</form>


function Setvalues() {
document.forms['participant_form'].submit();
opener.training_participant_select();
window.close();
}



Here i want to close this popup window after form submit and reload parent window,but if i use onsubmit or onclick event popupwindow will close and parent window will reloaded but form value not store in database,if i not use onsubmit or onclick form has submited but popup not close.




1 Answer
1



Please declare a variale for window.open :


function selectParticipants(id) {
myWindow = window.open('<?php echo base_url(); ?>
trainings/get_paticipant_list/' + id, 'popup', 'width=1000,height=600');
}



While closing use this :


myWindow.close();





my window will close ,but i want to at a time form data will store in data base as well as popup window close
– dipti
2 days ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV