{"id":1534,"date":"2016-07-07T21:09:14","date_gmt":"2016-07-08T02:09:14","guid":{"rendered":"http:\/\/xlinesoft.com\/blog\/?p=1534"},"modified":"2026-08-16T11:34:48","modified_gmt":"2026-08-16T16:34:48","slug":"displaying-a-popup-in-phprunner-9-0-asprunnerpro-9-5-asprunner-net-9-0","status":"publish","type":"post","link":"https:\/\/xlinesoft.com\/blog\/2016\/07\/07\/displaying-a-popup-in-phprunner-9-0-asprunnerpro-9-5-asprunner-net-9-0\/","title":{"rendered":"Displaying Popup Windows in PHPRunner and ASPRunner.NET applications"},"content":{"rendered":"<p><strong>Runner.displayPopup()<\/strong> provides a convenient way to display an application page or custom HTML in a popup window. The examples below cover the core options and common ways to use the function in PHPRunner and ASPRunner.NET.<\/p>\n<p>You can use this JavaScript function in places such as the JavaScript OnLoad event or the ClientBefore event of a custom button.<\/p>\n<p>The simplest example requires only the URL of the page to display. Here is how to open the Add page of the Products table:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nRunner.displayPopup({\r\n\turl: \"products_add.php\"\r\n});<\/textarea><\/pre>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2016\/07\/bootstrap_popup.png\" alt=\"\" title=\"bootstrap_popup\" width=\"570\" height=\"388\" class=\"alignnone size-full wp-image-1552\" srcset=\"https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2016\/07\/bootstrap_popup.png 570w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2016\/07\/bootstrap_popup-300x204.png 300w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2016\/07\/bootstrap_popup-150x102.png 150w, https:\/\/xlinesoft.com\/blog\/wp-content\/uploads\/2016\/07\/bootstrap_popup-400x272.png 400w\" sizes=\"(max-width: 570px) 100vw, 570px\" \/><br \/>\n<!--more--><\/p>\n<p>For the current API reference and additional examples, see the<br \/>\n<a href=\"https:\/\/xlinesoft.com\/phprunner\/docs\/how_to_display_any_page_in_a_popup.htm\">PHPRunner documentation for Runner.displayPopup()<\/a><br \/>\nor the<br \/>\n<a href=\"https:\/\/xlinesoft.com\/asprunnernet\/docs\/how_to_display_any_page_in_a_popup.htm\">ASPRunner.NET documentation for Runner.displayPopup()<\/a>.<\/p>\n<h3>Runner.displayPopup() options<\/h3>\n<p>The function supports the following options:<\/p>\n<p><strong>url:<\/strong> URL of the page to be displayed.<\/p>\n<p><strong>html:<\/strong> HTML code to display instead of loading a URL.<\/p>\n<p><strong>header:<\/strong> content displayed in the popup header.<\/p>\n<p><strong>footer:<\/strong> content displayed in the popup footer.<\/p>\n<p><strong>afterCreate:<\/strong> function called after the popup window is created.<\/p>\n<p><strong>beforeClose:<\/strong> function called before the popup window is closed. Return <em>false<\/em> to prevent the popup from closing or <em>true<\/em> to allow it to close.<\/p>\n<p><strong>width:<\/strong> popup width in pixels.<\/p>\n<p><strong>height:<\/strong> popup height in pixels.<\/p>\n<h3>Simple popup window<\/h3>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"products_add.php\",\r\n\twidth: 700,\r\n\theight: 500,\r\n\theader: 'Add new product'\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Using HTML instead of a URL<\/h3>\n<p>You can display HTML directly instead of loading another application page:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\thtml: \"<h1>Hello world!<\/h1><p>It works<\/p>\",\r\n\theader: 'Custom popup text'\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Using close()<\/h3>\n<p><strong>Runner.displayPopup()<\/strong> returns a Popup object. You can save that object in a variable and close it later:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"products_add.php\",\r\n\twidth: 500,\r\n\theight: 300,\r\n\theader: 'Add new product'\r\n});\r\n\r\nalert('That was an example of popup window');\r\n\r\nwin.close();<\/textarea><\/pre>\n<\/div>\n<h3>Using afterCreate()<\/h3>\n<p>The <strong>afterCreate<\/strong> function runs after the popup has been created. For example, you can use it to change the popup dimensions:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"products_add.php\",\r\n\theader: 'Add new product',\r\n\tafterCreate: function(win) {\r\n\t\twin.setWidth(700);\r\n\t\twin.setHeight(500);\r\n\t}\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Add a &#8220;Close window&#8221; link to the footer<\/h3>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"products_add.php\",\r\n\theader: 'Add new product',\r\n\tfooter: '<a href=\"#\" onclick=\"window.win.close();return false;\">Close window<\/a>',\r\n\tafterCreate: function(win) {\r\n\t\twindow.win = win;\r\n\t}\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Using beforeClose()<\/h3>\n<p>The <strong>beforeClose<\/strong> function lets you decide whether the popup can be closed. Return <strong>false<\/strong> to prevent it from closing.<\/p>\n<p>The following example prevents the popup from closing if the Product Name field is empty:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"products_add.php\",\r\n\theader: 'Add new product',\r\n\tfooter: '<a href=\"#\" onclick=\"window.win.close();return false;\">Close window<\/a>',\r\n\tafterCreate: function(win) {\r\n\t\twindow.win = win;\r\n\t},\r\n\tbeforeClose: function(win) {\r\n\t\tif ($('iframe').contents().find(\"input#value_ProductName_1\").val()==\"\")\r\n\t\t\treturn false;\r\n\t\telse\r\n\t\t\treturn true;\r\n\t}\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Show a &#8220;View customer&#8221; button on each row of the Orders List page<\/h3>\n<p>Insert a button into the Orders List page grid.<\/p>\n<h4>Server code<\/h4>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"php\" name=\"mshighlighter\" >\r\n$record = $button->getCurrentRecord();\r\n$result[\"CustomerID\"] = $record[\"CustomerID\"];<\/textarea><\/pre>\n<\/div>\n<h4>ClientAfter code<\/h4>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nvar win = Runner.displayPopup({\r\n\turl: \"customers_view.php?editid1=\"+result[\"CustomerID\"],\r\n\twidth: 700,\r\n\theight: 500,\r\n\theader: 'View customer'\r\n});<\/textarea><\/pre>\n<\/div>\n<h3>Show an Add page in a popup, close it after Save and refresh the List page<\/h3>\n<p>A common use of <strong>Runner.displayPopup()<\/strong> is to open an Add page from a List page, save the new record, close the popup and refresh the List page.<\/p>\n<p>The current PHPRunner documentation uses the following approach.<\/p>\n<h4>Button&#8217;s ClientBefore code<\/h4>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nwindow.popup = Runner.displayPopup({\r\n\turl: Runner.pages.getUrl(\"carsmake\", \"add\"),\r\n\twidth: 700,\r\n\theight: 700,\r\n\theader: 'Add Category'\r\n});<\/textarea><\/pre>\n<\/div>\n<h4>AfterAdd event<\/h4>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"php\" name=\"mshighlighter\" >\r\n$pageObject->setProxyValue('saved', true);\r\n$pageObject->stopPRG = true;<\/textarea><\/pre>\n<\/div>\n<h4>JavaScript OnLoad event of the Add page<\/h4>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nif ((proxy['saved']) && window.parent && window.parent.popup) {\r\n\twindow.parent.location.reload();\r\n\twindow.parent.popup.close();\r\n}<\/textarea><\/pre>\n<\/div>\n<p>If you want to close the popup without refreshing the List page, remove or comment out this line:<\/p>\n<div class=\"my-syntax-highlighter\">\n<pre><textarea id=\"mshighlighter\" class=\"mshighlighter\" language=\"js\" name=\"mshighlighter\" >\r\nwindow.parent.location.reload();<\/textarea><\/pre>\n<\/div>\n<p>For more details, see the<br \/>\n<a href=\"https:\/\/xlinesoft.com\/phprunner\/docs\/how_to_display_any_page_in_a_popup.htm\">PHPRunner Runner.displayPopup() documentation<\/a>,<br \/>\n<a href=\"https:\/\/xlinesoft.com\/asprunnernet\/docs\/how_to_display_any_page_in_a_popup.htm\">ASPRunner.NET Runner.displayPopup() documentation<\/a>,<br \/>\n<a href=\"https:\/\/xlinesoft.com\/phprunner\/docs\/popup_object.htm\">PHPRunner Popup object API reference<\/a>,<br \/>\nand<br \/>\n<a href=\"https:\/\/xlinesoft.com\/asprunnernet\/docs\/popup_object.htm\">ASPRunner.NET Popup object API reference<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Runner.displayPopup() provides a convenient way to display an application page or custom HTML in a popup window. The examples below cover the core options and common ways to use the function in PHPRunner and ASPRunner.NET. You can use this JavaScript function in places such as the JavaScript OnLoad event or the ClientBefore event of a custom button. The simplest example requires only the URL of the page to display. Here is how to open the Add page of the Products table: Runner.displayPopup({ url: &#8220;products_add.php&#8221; });<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,1,4,3],"tags":[],"_links":{"self":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1534"}],"collection":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/comments?post=1534"}],"version-history":[{"count":27,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1534\/revisions"}],"predecessor-version":[{"id":3436,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/posts\/1534\/revisions\/3436"}],"wp:attachment":[{"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/media?parent=1534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/categories?post=1534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlinesoft.com\/blog\/wp-json\/wp\/v2\/tags?post=1534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}