This topic is locked
[SOLVED]

closing a popup via button code

12/2/2024 12:32:30 PM
PHPRunner General questions
francesco author

I’m using Runner.displayPopup in PHPRunner to open a popup and I want to close it with a button indise. I’ve tried:
-popup.hide()
-Making popup global (window.popup) and calling window.popup.hide().
-Using jQuery to target the popup: $(".runner-modal-window").modal('hide').remove();

None of these work. How can I programmatically close this popup? Thanks

C
cristi 12/2/2024

Well, you didn't tried popup.close() for closing

From the manual: https://xlinesoft.com/phprunner/docs/popup_object_close.htm

francesco author 12/2/2024

Thanks it was the first I tried before the alternatives, but it doesn't work. Maybe the problem is that I want to close a popup from within the popup itself.

G
Grdimitris 12/2/2024

From manual
https://xlinesoft.com/phprunner/docs/how_to_display_any_page_in_a_popup.htm
example 7, keep the afterCreate: and do not use beforeClose. The footer has another way to close the window but returns to landing page.
var popup = Runner.displayPopup( {
url: "products_add.php", // the page to display
header: 'Add new product',
footer: '<a href="#" onclick="window.win.close();return false;">Close window</a>',
afterCreate: function(popup) {
window.popup = popup;
}
});
In popup add button and in before client add window.parent.popup.close(); return false;

francesco author 12/4/2024

thanks, Grdimitris solution was fine!