This discussion is archived
9 Replies Latest reply: Jun 15, 2012 12:00 AM by Tom Petrus RSS

Skillbuilder Modal Page - Dynamic Title

939283 Newbie
Currently Being Moderated
Hi All,

I am using skillbuilder modal page plugin to display a modal page. I want the title of the page to be dynamic.

I am creating a dynamic list and on click of each item in that list I want a page to be displayed as a pop up.
I am able to get this work but now I want the Title of the pop up window to be same as the label in dynamic list.
Is there any way to achieve this???

Apex Version: 4.1
Database: Oracle 11g XE

Thanks in advance,
Abhishek
  • 1. Re: Skillbuilder Modal Page - Dynamic Title
    jozef_SVK Journeyer
    Currently Being Moderated
    Hi,

    Use title in the modal popup plugin DA like: Title &P_ITEM.

    P_ITEM - dynamicaly populated dummy field.

    First populate the field and then call modal popup in the DA.
    The title should contains the P_ITEM value now.

    Regards
    J :D
  • 2. Re: Skillbuilder Modal Page - Dynamic Title
    939283 Newbie
    Currently Being Moderated
    Thanks jozef,

    Got it.
  • 3. Re: Skillbuilder Modal Page - Dynamic Title
    939283 Newbie
    Currently Being Moderated
    Hi Jozef,

    I am not able achieve this.
    I created an item. Using dynamic action, I am populating value in it as well but the popup window is taking old value.
    You can have a look at the following link...

    http://apex.oracle.com/pls/apex/f?p=44467:3:96107314363501::NO::P3_PRIVILEGE:1

    Username: sysadmin
    Password: sysadmin

    When you click on list items in the middle section, Popup is taking old value.

    Please assist.

    Thanks,
    Abhishek
  • 4. Re: Skillbuilder Modal Page - Dynamic Title
    939283 Newbie
    Currently Being Moderated
    Getting issues
  • 5. Re: Skillbuilder Modal Page - Dynamic Title
    Tom Petrus Expert
    Currently Being Moderated
    Jozef's answer is correct, and i can see from looking at your page source that you've got the gist of it: you set the item value, and you submit it to session state. That is good.
    What you get wrong is the session state substitution.
    For example, load your page the first time
    <ul><li>the hidden item is empty</li><li>you click a modal link, firing the dynamic actions: 'Define Privileges' gets filled out in the item value and submitted to session state</li><li>the modal page pops up, but you can see no title is visible</li><li>Now F5 the page</li><li>Click 'define users'</li><li>your modal page title will be 'Define privileges'</li></ul>

    You forgot that session state substitution occurs on page rendering. When you fire a dynamic action, the attributes are already known and they won't change. Ie, your title attribute will have been set to the session state of the item you reference at rendering time, NOT when the action is fired. Again, this is evident when looking at the page source: on first load, attribute 1 is NULL and not supplied to the DA. On refresh and after a click, it is.

    If you want to solve this there is only one way: use javascript. The modal page plugin also supplies events you can hook into. You can use the "Start open" or "End open" event for a dynamic action, and in their true actions you can have javascript which takes the value of your clicked link/hidden item, and put that in the modal page title.
    For example, this is the modal page html markup for the title in theme 3
    <div id="cboxTitle" style="float: left; display: block;">Existing Pictures</div>
  • 6. Re: Skillbuilder Modal Page - Dynamic Title
    939283 Newbie
    Currently Being Moderated
    Hi Tom,

    I am not able to use the Skill Builder events.
    They are not executing at all.

    Plz help.

    Thanks,
    Abhishek
  • 7. Re: Skillbuilder Modal Page - Dynamic Title
    Tom Petrus Expert
    Currently Being Moderated
    Hi Abhishek,

    You are right, unfortunately. I tried to bind some actions to the provided "Start open" and "End open" events, and they don't work (the others do though).
    I took a look at the javascript for the modal and found the problem: <ul><li>the plugin does fire events that represent these processing points</li><li>the events are not named the same as those specified in the plugin events</li></ul>

    In short, to be able to do processing at these points, you can do 2 things: A) edit the plugin so the correct events are being caught or B) manually bind a handler to the events fired

    Route A)
    <ul>
    <li>Shared components > plugin</li>
    <li>Edit the plugin (skillbuilder modal page)</li>
    <li>go to the Events region</li>
    <li>change the "*Internal Name*" of "*End Open*" from "*modalpageendopen*" to "*apexmodalpagecomplete*"</li>
    <li>change the "*Internal Name*" of "*Start Open*" from "*modalpagestartopen*" to "*apexmodalpageopen*"</li>
    </ul>

    You can now use these events in your dynamic actions across your application without further hassle. This is the cleanest route in my opinion, until an "official" fix is available.
    If you want to verify my code, simply go to the "source" directory of the unzipped plugin and edit "apex_modal_page.js", line 113 and 118.
    If you want to reuse the corrected plugin, do an export of it and reuse it in your other apps.

    Route B)
    less clean, and you'd have to do this on each page you'd like to use this event for, but great if you want to test:
    $(document).bind("apexmodalpagecomplete", function(){$("#cboxTitle").text("Test");});
    Same for apexmodalpageopen.

    I'll send Skillbuilders support an email about this bug too, if they aren't aware of it yet.
  • 8. Re: Skillbuilder Modal Page - Dynamic Title
    939283 Newbie
    Currently Being Moderated
    Hi Tom,

    I tried both these options but its not working for me.
    Looks like either something is wrong or I am missing anything but I did the changes exactly as you said.

    Thanks,
    Abhishek
  • 9. Re: Skillbuilder Modal Page - Dynamic Title
    Tom Petrus Expert
    Currently Being Moderated
    Hi Abhishek,

    What version of the popup plugin are you using? I myself use version 2.0.0.
    When you run your page: any javascript errors you can spot in firebug?
    Can you try with an alert?
    $(document).bind("apexmodalpagecomplete", function(){ alert("opening complete"); });
    If nothing helps, set up an example on apex.oracle.com and give us the workspace name and developer login credentials so we can take a look.

Legend

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