This content has been marked as final. Show 5 replies
What is it you're trying to do exactly: you want to trigger a close action from clicking the close button on the modal page frame, and transfer a value from the modal page to the parent in this case too? What event are you trying to hook into for this?
If you are trying to hook into the "Close" event: it is bugged. Same for "Start Open" and "End Open". You can easily fix this however. The events triggered from the plugin are named differently than the events specified in the plugin events. To fix it, go to Shared Components > Plugins and edit the modal page plugin. Scroll down to the "Events" section where you can see the different events provided. Edit the following entries and change the "Internal Name"
<li>Start Open : apexmodalpageopen</li>
<li>End Open : apexmodalpagecomplete</li>
<li>Close : apexmodalpageclosed</li>
Basically, I've managed to pass value to parent form from modal page when clicking on button on modal page.
(The scenario is that I have IR with little details and I want to show more detail in modal page. Clicking on a button on modal page user accepts that he or she
wants to work with that data - that's why I'm passing some value from modal page as conformation. If one clicks on close button on modal page frame, that means that
he or she wants to "work" with another row - but previously returned value stays on form)
I'll try your workaround and post it later.
I just figured out to try to clear that field on parent page when opening modal page !?
Manual closing fires when you click the close icon. It also fires when you close the dialog through code. When using the code you can indeed provide a return value. You can't really steer the icon though. This is simply the colorbox plugin firing its closing events, and the modal page plugin has some handles on those events. When you close the box with code, you can set a variable, and this variable is then stored in the plugin. Then the "close" is triggered on the colorbox plugin, which in turn will cause callbacks defined by the modal popup plugin to fire. In there is a check whether it is autoclose or not, and if not, it will set the return values with the stored return value or no value.
I'd say there is no way to interfere there, not in a clean way. Overriding the colorbox close function is of no help for example, not if you want to pass values through the modal popup. You can't manually set the return value of the modal page because the property is private.
In my opinion you should make it clear that clicking the close icon means as much as cancelling the action, ie not accepting nor rejecting the data. That is a much more meaningful behaviour: if you'd have form open in a window and closed the window, you'd effectively discard any changes..
If you still want to go through with it though, you might want to consider if defining a global variable in the parent page and setting it might help you.