4 Replies Latest reply: Jul 19, 2013 3:30 PM by Tom Petrus RSS

    Apex 4.2: modal page (plugin) closure - javascript

    emma-apex

      Hi

       

      Can anyone tell me how to close a modal page using the buttons on that page's tabular report, i.e. Cancel and Submit?

      I'm using Apex 4.2. I've added a skillbuilders plugin modal page. It mostly works great - pops up, contains a tabular editable form, and then closes when i click the cross.

      So the problem is using the buttons Cancel, Delete and Submit. They work in the sense that Delete does in fact delete rows, and submit submits them. But they don't close the modal page.

       

      I've tried many combinations. Below is the latest. Can someone spot where I'm going wrong? Thanks

       

      Page 41 launches the modal region using dynamic action (this bit works):

      DA Name: BTN_MILESTONES

      Event: Click

      Selection type: Button

      Button: EDIT_MILESTONES

      Condition: no condition

       

      Page 41 DA true action:

      Action: skillbuilders modal page 2.0 plugin

      Fire on page load: No

      URL location: statically defined

      URL: f?p=&APP_ID.:43:&APP_SESSION.:::1:::

      Autoclose: div#uSuccessMessage

      ModalpageID: 'editMilestones' (*** this might be the problem - have tried with "" and without any quotes but don't think modal page 43 can see this***)

       

      Page 43 page template: pop-up

       

      Page 43 Cancel button: defined by dynamic action

       

      Page 43 dynamic action

      name: closeModal

      Event: Click

      Selection type: Button

      Button: CANCEL

      Condition: no condition

       

      Page 43 DA true action:

      Action: execute js code

      code: this.data.modalPageClose;

      selection type: DOM object

      DOM object: 'editMilestones'

       

      When I click CANCEL on page 43 (pop-up), I see the bottom left corner on my IE8 screen of Page 41 (launch page) moves to error. Double clicking on this error tells me {Message: Syntax error, unrecognized expression: #'editMilestones'}

       

      So I've focused my efforts on changing this DA but I'm not getting anywhere. Please help if you can!

       

      Thanks

      Emma

        • 1. Re: Apex 4.2: modal page (plugin) closure - javascript
          emma-apex

          I've also tried the JS function method: https://forums.oracle.com/thread/2276204 but no luck with this either. Also every time I click the Cancel button, my next click on the developer interface logs me out completely (I remained logged in to the frontend). I know there's reams written on this but i have tried a lot of options now and nothing works at all. Do I have to "switch on" JS somewhere before it'll work (this is a new server and new product for our org so if there's something global like this we might not have come across it yet). Thanks.

          • 2. Re: Apex 4.2: modal page (plugin) closure - javascript
            Kofi

            Emma,

            typically the way I've used this plugin is as follows; Say page 41 is your main page and page 43 is your popup page.

            • Create a blank page 102 which does nothing(empty page which does nothing, I stuck with the Skillbuilders demo app choice ).
            • Create a process on page 43 to go to page 102

                   The key thing is to ensure that "

            • Obviously on page 41 you have a way to call your modal page 43.

            That's the high level. Let me know which specifics you need.

            Kofi

            • 3. Re: Apex 4.2: modal page (plugin) closure - javascript
              J-Lig

              Ive never used that plug-in, but I have used the built-in APEX Modal Region and all you have to do with those is add a dynamic action on click for the button and have it perform the following javascript statement: openModal('region_static_id') or closeModal('region_static_id')

              • 4. Re: Apex 4.2: modal page (plugin) closure - javascript
                Tom Petrus

                modal page id: used only on the parent page, mainly to use as a distinguisher in for example close events.

                Your true action on P43 is completely off the mark. No affected elements. The code is not this.data.modalPageClose, but

                parent.$(parent.document).apex_modal_page('close');
                

                 

                You can find this in the included documentation really!