This discussion is archived
1 2 Previous Next 19 Replies Latest reply: Aug 3, 2012 4:04 PM by sect55 RSS

Skillbuilder Modal Page Close

sect55 Journeyer
Currently Being Moderated
Gurus like Dan McGhan, etal.,

I am trying to use Skillbuilder's Modal Page to display a report of outstanding requisition when someone wants to create a new requisition. The condition of the modal page is EXISTS (select 'X' from requisition where requester_emp_id = :APPL_req_emp_id. It displays fine. I want the modal page to close and link to the page with the key when the use clicks on the edit icon (which I gave class "edit-click") to view/update an existing requisition or the NEW button (to create a new requisition) on top of the report. How do I do that. I reviewed the documentation and viewed the demo (a few times) and haven't had much success.

Robert
http://apexjscss.blogspot.com

Edited by: sect55 on Aug 3, 2012 7:07 PM
  • 1. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    Let me check if i get this correct:
    from your report of requisitions, you open a modal page popup. In this popup you create a requisition.
    What is it you want to happen then? Do you want the modal to close, and then have your main page (that with the requisition report) redirected to an edit form?

    Or do you simply want your req. report to behave as normal, but with edit links per record, and a NEW button at the top of your report, but instead of navigation to a form page, open up a modal page with that form?
  • 2. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    Tom,

    No. From my form, I display a report listing outstanding requisitions for the employee with a CREATE button and edit icons. I want to modal page to close when the button or icon is pressed and process the associated action.

    Robert
    http://apexjscss.blogspot.com
  • 3. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    Ok, so basically, you want to close the page, and return some value to your form page. This isn't auto-closing though. Auto-close will close the popup when an element matches the jquery selector configured in the auto-close setting of your modal page.
    You need manual closing for both your edit links and the new button, and return an object. In your form you will need to have a dynamic action reacting to the manual close event.
    See this thread,it details manual close:
    {thread:id=2407235}

    What extra you will need is the actual return. I'd suggest to return a small json object, which can hold the action and an optional record id. In your form page manual close event handler you can then inspect this object, and perform the correct actions: basically a redirect (or submit, whatever floats your boat :) ).

    Also, see this thread. The plugin has a bug that breaks the manual open/close events. You'll need to fix this in order for this to work. (it's in a reply of me towards end)
    {thread:id=2394648}

    Hopefully that helps you forward. If you can't work it out, set up an example and i can take a look for you.
  • 4. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    Tom,

    I'm confused so I set up the application on apex.oracle.com

    Workspace: RGWORK
    User: TESTER
    Password: test123

    Application : 32022     CSRSR

    Menu only has one selection, select it.

    Thank you,
    Robert
    http://apexjscss.blogspot.com
  • 5. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    Tom,

    Thanks anyway. I solved my problem. I realized all I need to do is close the modal page (which is the child page) from the child page. So I set up 2 dynamic actions in the child page to close the page if the link was pressed or the Create button (which I added on my site) was pressed. The link will do its normal think so I did not remove its functionality so I don't have to pass the #ID# column (link column).

    Thanks for your help.

    Robert
    http://apexjscss.blogspt.com
  • 6. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    sect55 wrote:
    Tom,

    Thanks anyway. I solved my problem. I realized all I need to do is close the modal page (which is the child page) from the child page. So I set up 2 dynamic actions in the child page to close the page if the link was pressed or the Create button (which I added on my site) was pressed. The link will do its normal think so I did not remove its functionality so I don't have to pass the #ID# column (link column).

    Thanks for your help.

    Robert
    http://apexjscss.blogspt.com
    Hi Robert,

    sorry i didn't get back to you earlier! I did take a look at your application, and all that was really missing was the closing part of the modal page with the returning id and an action processing that on the parent page. I was however stuck with javascript errors, and nothing worked (at work i only have IE8 to go to the web :(), even after disabling dynamic actions. Luckily you were able to figure it out!
  • 7. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    The issue has not been resolved. I thought the modal page was closed but what really happened was that another modal page was displayed and fit my entire form after I clicked the edit icon on the report.

    I modified the application that it now does close the modal page and assigns ID when the modal is closed. But the screen does not display the information related to ID even though I also explicitly refreshed all the regions on the page after assign the modal page value to P11_ID.

    PLEASE HELP!!

    Robert
    http://apexjscss.blogspot.com
  • 8. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    I made some changes:

    Page 11:
    Your manual close dynamic action:
    You were almost there. You set the value of P11_ID to the returned value, which is good, but not enough. Queries in reports work with the session state, but the value of an item in the document is not session state. You need this item to be submitted to session state.
    <ul>
    <li>I removed all the refreshes. A refresh only works on reports, it does not on items!</li>
    <li>I added a true action which submits the page. Since P11_ID now has a value, it will submit this to the session state. The page reloads, and the row fetch process will fetch the values for your primary key (P11_ID) now. Since the modal has a condition which checks whether P11_ID is empty no modal will popup.</li>
    </ul>

    Page 7:
    Manual close dynamic action. Wrong!
    window.parent.$(window.parent.document).apex_modal_page('close','#ID#');
    You can't use #ID# in a dynamic action like that. You need to fetch a value from the DOM somewhere, which is why i used the HREF attribute as a makeshift container for this on the column link.
    parent.$(parent.document).apex_modal_page('close', $(this).attr('href'));
    This will take the ID value stored in href from the triggering element, ie, the elements with .edit-click as a class, ie the column links.
    So i set the column link back to Target: URL, and URL to #ID#

    For the create button:
    you simply close the modal. This would trigger a manual close aswell. In this case the modal just needs to close. However, with my earlier change which submits...
    I changed the dynamic action on P11 for the manual close to just run javascript code:
    var lReturn = this.data.modalPageCloseValue;
    
    if(lReturn){ //there is a return value
       if(lReturn=='CREATE'){
          //no submits, just close dialog
       }else{
          //an ID is returned. Set P11_ID and submit the page
          $s('P11_ID',  this.data.modalPageCloseValue);
          apex.submit();
       };
    };
    Due to JS errors in IE8 i can't (at least from here. And there is too much going on, and i hate F12 >:() . See if it works or if you can figure it out from here.
  • 9. Re: Skillbuilder Modal Page Auto close
    dmcghan Oracle ACE
    Currently Being Moderated
    Robert,

    The credentials you specified above are not working.

    Regards,
    Dan

    blog: http://DanielMcghan.us/
    work: http://SkillBuilders.com/APEX/
    twitter: https://twitter.com/dmcghan
  • 10. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    Hi Dan,

    The credentials are correct. Password (test123) must be in lowercase. I tried it twice and I was able to get in both times.

    Thank you.

    Robert
    http://apexjscss.blogspot.com
  • 11. Re: Skillbuilder Modal Page Auto close
    sect55 Journeyer
    Currently Being Moderated
    Tom,

    I tried to testing (in IE 7) and when I clicked on the edit icon it doesnt do anything.

    Robert
    http://apexjscss.blogspot.com
  • 12. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    There, i finally got it to work... Firefox/firebug is really a great tool.
    Apparently, there were javascript errors thrown by the dynamic action on the modal page. Don't know why, it seemed to trip over the few lines of comments i placed in them.
    Let me also say that your app isn't easy to figure out. The modal was not opening because the application item APPL_PC_EMPLID was not set. I looked up an id in the table and took one from there. Please make sure to pave out such technicalities in the future. To fill it i used the enable debug process:
    :APPL_PC_EMPLID := 25639;
    Changed the modal manual close action. No submit needed, validations fire. Unless you wish to submit with a request value to trigger a branch pre-validations. I opted to change it to a redirect:
    window.location.href = 'f?p=&APP_ID.:&APP_PAGE_ID.:&SESSION.::::P11_ID:'+this.data.modalPageCloseValue;
    Now i hope you actually get this working in IE7... In the latest FF it displays fine, i'm not sure what IE7 will do. Theme20 is an IE6 compatible theme, i'm pretty sure the modal page plugin will require html5 doctype declaration (it did in IE8, i'm assuming IE7 will be another cat in a bag).
  • 13. Re: Skillbuilder Modal Page Auto close
    dmcghan Oracle ACE
    Currently Being Moderated
    Hi Tom,

    Glad you figured it out... :)

    Regards,
    Dan

    blog: http://DanielMcghan.us/
    work: http://SkillBuilders.com/APEX/
    twitter: https://twitter.com/dmcghan
  • 14. Re: Skillbuilder Modal Page Auto close
    Tom Petrus Expert
    Currently Being Moderated
    Dan McGhan wrote:

    Glad you figured it out... :)
    Did I? Or does it only start now? :)

    It's been a struggle so far, but now that i saw it actually working i'm a happy camper for the moment. Roll on a new day. ;)
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points