search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Which java script files and functions are absolutely essential to close a modal form?

Asked by mrplatypus
6 years ago.

Hi Dan and Team,

In two other related postings:

I asked how to open a modal form and how to close the modal form..

As a related issue:

1) Please would you advise on which javascript files and functions are absolutely essential close a modal form ?; and

2) Where the javascript methods should be referenced in terms of the calling/hosting page and modal form?

Thanks & Regards


Answer posted by Dan Letecky [DayPilot]
6 years ago.

With the default settings, the modal dialog uses an iframe to display the content. That means the content is working with a different window context.

In order to open the modal dialog, you need to include daypilot-modal.js from The latest version is 2.5 but one of the older versions can be included in a specific tutorial/demo. It's recommended to use the latest version so you have access to the latest API.

There are two ways to close the modal dialog:

1. From the parent window (that one which opened the modal dialog):


2. From the modal dialog itself:

Method 1 - reach the parent context:


No extra libraries are needed, the parent context already has access to daypilot-modal.js.

Method 2:

Include daypilot-modal.js in the modal page itself and call:


3. If the modal page is an ASP.NET WebForm you can use the server-side helper (DayPilot.Modal.cs from and call Util.Modal.Close() on PostBack. This will complete the PostBack and close the modal dialog.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.