Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Closing a form

Avatar

Former Community Member
OK....This should be really simple, but I must be missing something fundamental. I'm trying to close a form using a click event of a regular button. Adobe Javascript reference guide dictates the following:



var d = app.activeDocs;

for( var i in d ) d[i].closeDoc();



but.... d returns no active Docs. So that doesn't work.



I've looked in the Adobe Designer help, and the XFA 2.2 for insite but no luck.



Any help would be greatly appreciated.
4 Replies

Avatar

Former Community Member
You can use the following to close the form. The only thing you want to be aware of is that it only works when the form is opened in Acrobat or Reader (not when it is opened in a browser).



app.execMenuItem("Close");

Avatar

Former Community Member
I tried this and I received a "This action cannot be performed from within an external window" dialog.



My test was within Adobe Designer.



Is it possible to close it in a browser? Self.Close; is the javascript for closing a browser, but I can't find documentation if there is an Adobe Javascript equivalance.

Avatar

Former Community Member
The app.execMenuItem("Close") works as if you are trying to close a PDF document from Acrobat using File>Close or Ctrl+W . If the document is opened in any external window (Browser,Designer,or other integrated application), this will not work.

Avatar

Former Community Member
Hi,



I'm also trying to use the method app.activeDocs. Does this work in a Designer-Form?



Thanks,



Valerio