FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.



Oct 20, 2016, 11:36 AM
50 Posts

Close dialog with button from iframe

  • Category: Extension Library
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: dialog,iframe,cross domain
  • Replies: 0

I've got a real puzzler, at least for me it is. I have doc1 in db1 opened in an XPage. On the XPage is a view of of related documents (doc2) in a different database (db2) on the same server. I am using a repeat control with a link wrapped around each entry to open doc2 in a dialog. Because doc2 has fileUpload and fileDownload controls on it, I have to open doc2 in an iframe* in the dialog. I have all the file upload/download stuff working thanks to Toohey's article File Upload XPage Forms via OpenNTF.org Extension Library Dialogs.

The problem is that I am unable to get the dialog to close with a button in the iframe. The difference between my scenario and Toohey's is that I am working with a document in another database (cross domain, I believe). I am unable to get a handle on the parent document from within the child document in the iframe so i can close the dialog. It looks something like this:

<html><body>

<form action="db1.nsf/mainDoc.xsp?doc1&action=openDocument"></form>

<div id="dialog"><form action="db1.nsf/mainDoc.xsp?doc1&action=openDocument">

<iframe src="showDialog.xsp?databaseName=db2.nsf&doc2">

<html><body><form action="db1.nsf/showDialog.xsp?databaseName=db2.nsf&doc2&action=editDocument">

<button id="okBtn" type="submit">OK</button>

</form></body></html>

</iframe>

</div>

</body></html>

*Note: showDialog.xsp is an XPage in db1 with it's data source being the form for doc2 in db2. (I'm using xp:panel with tagName="iframe".)

I want the OK button to save the document (which it does) and close the dialog (which it doesn't). I have tried several different methods of "parent...." to get a handle on <div id="dialog"> and close it with no success at all. I am unable to get a handle on anything in the parent doc because, I think, it is in a different database than doc2 in the dialog/iframe.

Thanks in advance for any response.


FORUM PLAN UPDATE
Date revision: This forum will remain open to new posts and responses until December 1, 2018. (After that date, you will still be able to view and search the forum.) Also, we're taking a second look at the best place to host future conversation. For now, keep using this forum, and stay tuned for more news.