This topic is locked
[SOLVED]

 Modal Popup

10/23/2018 3:53:17 PM
PHPRunner General questions
J
jaffleck author

Well, I have no hair left to pull out after two solid days of trying to display an add window in a modal popup. I believe I have read every post on the subject multiple times and followed the instructions a best as I can (I am not a practiced javascript coder.....) and I still cannot get the popup to appear.

I have enabled all popups in the browser (Chromium and FireFox), I do not see any javascript errors being generated, I can see the function being called, but nothing appears on the screen!

I have created the following javascript file called MigTools10.js:
====================================================================
function displayPopup(params)

{

var pageid=1;

var pageObj = Runner.pages.PageManager.getById(pageid);

args = {

bodyContent: "<iframe frameborder='0' id='popupIframe" + pageid + "' style='width: 100%; height: 100%; border: 0;'></iframe>",

footerContent: "<span>&nbsp;</span>",

headerContent: params.headerContent,

centered: true,

render: true,

width: params.width ? params.width : 450,

height: params.height ? params.height : 315

},

afterCreateHandler = function(win) {

var bodyNode = $(win.bodyNode.getDOMNode()),

iframeNode = $("iframe#popupIframe" + pageid, bodyNode);
iframeNode.load(function() {

if (Runner.isChrome) {

bodyNode.addClass("noScrollBar");

}

win.show();
}).attr("src", params.url);

},

afterCloseHandler = params.afterClose;
if (Runner.isChrome) {

$("< style type='text/css'> .yui3-widget-bd::-webkit-scrollbar {display:none;} < /style>").appendTo("head");

}
Runner.pages.PageManager.createFlyWin.call(pageObj, args, true,

afterCreateHandler, afterCloseHandler);

}
function select_env()

{

params =

{

url: 'MIGTOOLS_SELECT_ENV_add.php',

afterClose: function(win)

{

win.destroy(true);

},

headerContent: 'Select Connection'

};
displayPopup(params);

}
=================================================================================
and placed the following in the header option on the editor tab (Version 10):
=================================================================================
<script src="MigTools10.js" type="text/javascript"></SCRIPT>
=================================================================================
Then in the Client Before event of a custom button on a list page I have this:
=================================================================================
select_env();
=================================================================================
As I said - I can see this function being called and apparently without any errors, so why does the popup not appear?
Thanks for the help.....

admin 10/24/2018
J
jaffleck author 10/24/2018



Maybe use built-in functionality:

https://xlinesoft.com/phprunner/docs/how_to_display_any_page_in_boo.htm



I tried that, but the popup is not modal. I need to capture some info in the Client Before event before the Server event fires. So the built-in approach does not work, unless there is a way to make the popup modal.

admin 10/25/2018

It wouldn't work this way, Javascript doesn't work that way. It doesn't matter if you use a third party popup or a built-in one.
You need to change your approach. For instance, if you display Add page in popup you can move code from button's server event to that page event like BeforeAdd.
Javascript dialogs are modal in the way that user cannot do anything before popup is closed. But code behind the scene keeps running and Server event will be executed right after your dialog is shown.

J
jaffleck author 10/25/2018



It wouldn't work this way, Javascript doesn't work that way. It doesn't matter if you use a third party popup or a built-in one.
You need to change your approach. For instance, if you display Add page in popup you can move code from button's server event to that page event like BeforeAdd.
Javascript dialogs are modal in the way that user cannot do anything before popup is closed. But code behind the scene keeps running and Server event will be executed right after your dialog is shown.



OK. I found a work-around. Thanks for the effort.