· Updated

Displaying Popup Windows in PHPRunner and ASPRunner.NET applications

ASP.NET, PHP, PHP Code Generator, PHP Form Generator

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:


For the current API reference and additional examples, see the
PHPRunner documentation for Runner.displayPopup()
or the
ASPRunner.NET documentation for Runner.displayPopup().

Runner.displayPopup() options

The function supports the following options:

url: URL of the page to be displayed.

html: HTML code to display instead of loading a URL.

header: content displayed in the popup header.

footer: content displayed in the popup footer.

afterCreate: function called after the popup window is created.

beforeClose: function called before the popup window is closed. Return false to prevent the popup from closing or true to allow it to close.

width: popup width in pixels.

height: popup height in pixels.

Simple popup window

Using HTML instead of a URL

You can display HTML directly instead of loading another application page:

Using close()

Runner.displayPopup() returns a Popup object. You can save that object in a variable and close it later:

Using afterCreate()

The afterCreate function runs after the popup has been created. For example, you can use it to change the popup dimensions:

Add a “Close window” link to the footer

Using beforeClose()

The beforeClose function lets you decide whether the popup can be closed. Return false to prevent it from closing.

The following example prevents the popup from closing if the Product Name field is empty:

Show a “View customer” button on each row of the Orders List page

Insert a button into the Orders List page grid.

Server code

ClientAfter code

Show an Add page in a popup, close it after Save and refresh the List page

A common use of Runner.displayPopup() is to open an Add page from a List page, save the new record, close the popup and refresh the List page.

The current PHPRunner documentation uses the following approach.

Button’s ClientBefore code

AfterAdd event

JavaScript OnLoad event of the Add page

If you want to close the popup without refreshing the List page, remove or comment out this line:

For more details, see the
PHPRunner Runner.displayPopup() documentation,
ASPRunner.NET Runner.displayPopup() documentation,
PHPRunner Popup object API reference,
and
ASPRunner.NET Popup object API reference.

5 thoughts on “Displaying Popup Windows in PHPRunner and ASPRunner.NET applications

  1. I just came across this blog post. THANK YOU!!!!! This is absolutely perfect. I works with any URL which really helps my current project. Looks awesome with the Bootstrap theme.

  2. THX! very cool. I tried the “view customer” button and it looks fantastic. How can I manage to close the Pop up when clicked “save” here?
    THX
    Andreas

  3. how to passing an array through that GET request?

    while ($data = $button->getNextSelectedRecord() ) {
    $result[“id”]=$data[“id”]; // array..

    }

    Client after

    var win = Runner.displayPopup( {

    url: “test.php?id=”+result[“id”],

    width: 900,

    height: 600,

    header: ‘Demonstrativo Exportacao’

    });

Leave a Reply

Your email address will not be published. Required fields are marked *