Download file AND Close a Popup Editor?

Download file AND Close a Popup Editor?

  
I have a report that gets generated and has a few options set via a popup editor. I'm using the HtmlToPdf extension (which works great) but I've run in to the following problem:

1. If I have the Submit action on the button set to Submit, the file downloads properly, but the PopupEditor_Close action is ignored.
2. If I have the Submit action on the button set to Ajax Submit, the PopupEditor_Close action fires, but the file isn't downloaded.
3. If I use the OnNotify action, with a passed parameter, to test for if the parameter is the type that generates this particular report and, if so, generate the report and download the file, then the instance hangs; it just sits there with the "Loading" spinner in the corner.
4. If I use the OnNotify action like above but put the test at the end of the action (after the refreshes for the tables on the page), I get the error "
Hi Len,

Yes that is really tricky because after a download node the browser actually stops the current request execution (just like you have left the page). So the alternatives are very limited.

My first aproach was to place a hidden link (with target="blank) in the popup, click the link and then close the popup. ...but the my browser (and AdBlocker) refused to let me open a popup.

So here is an alternative solution:
  • Have a Hidden Button (with action Submit, or download nodes don't work) in the page that goes to a download page.
  • Have the Popup do a NotifyWidget to tell the report id (probably something like you did on 3), set it to a local variable so it can be used in the button Destination.
  • At the end of the OnNotify do a WidgetClick on the Hidden Button.
Attached you can find my example oml.
Also it's published on my personal (at least for now) if you want to check it.

Regards,
João Rosado
YES, Excellent. That did the trick.

The piece of information I was missing was that WidgetClick action. After that, quite simple. Thank you very much!