5 Replies Latest reply: Jan 23, 2013 8:04 AM by Tom Petrus RSS

    Skillbuilder's modal page - pass value when click on close button

    890493
      Hi,

      I've been playing with Skillbuilder's modal page plugin and it's working great!

      Now I have an issue: I have a page with IR and when one click on link button a modal page is shown providing "more detail" about the selected row.

      I've created a close button on a modal page, implemented manual close event on IR page where I'm passing some value from modal page to IR page.

      Now I'm trying to do the same when clicking on the close button of the modal page, but, unfortunately without success.

      I've tried to create a DA based on JQuery Selector #cboxClose but it's not working.

      Does anyone have similar issue or even solved one?

      I'm using APEX 4.2.1.

      Regards,

      Boris
        • 1. Re: Skillbuilder's modal page - pass value when click on close button
          Marko Goricki
          Hi Boris,

          It's because close icon is in iframe parent window. You can access it with (to get jQuery object):
          $('#cboxClose', window.parent.document)
          Br,
          Marko Goricki
          ---------------------------
          http://apexbyg.blogspot.com/
          • 2. Re: Skillbuilder's modal page - pass value when click on close button
            Tom Petrus
            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"
            <ul>
            <li>Start Open : apexmodalpageopen</li>
            <li>End Open : apexmodalpagecomplete</li>
            <li>Close : apexmodalpageclosed</li>
            </ul>

            As you might pick up, just add "apex" in front of the existing value. The plugin javascript code fires the apex-prefixed events instead of the ones specified in the plugin. This causes dynamic actions hooked into those events not to fire (because they are never fired).
            • 3. Re: Skillbuilder's modal page - pass value when click on close button
              890493
              Hi Marko,

              I've tried your suggestion by it didn't work well.

              I'll try later - not having time right now :)

              Best regards,

              Boris
              • 4. Re: Skillbuilder's modal page - pass value when click on close button
                890493
                Hi Tom,

                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 !?

                Regards,

                Boris
                • 5. Re: Skillbuilder's modal page - pass value when click on close button
                  Tom Petrus
                  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.