This discussion is archived
9 Replies Latest reply: Oct 22, 2013 4:50 AM by 0186c429-d97a-481d-b68c-a4b1c8078119 RSS

Apex 4.2: Pop-up LOV and dynamic actions - known bug?

emma-apex Newbie
Currently Being Moderated
Hello

I have a couple of pop-up LOVs and in some cases I want to set their values using a dynamic action.

It works fine on a select but not on a pop-up LOV. I have read about this by googling and lots of people have had the same problem.

I just want to know if there is any kind of workaround for this, e.g. hiding fields and setting values from them. Really I'd like to know precisely what the problem is, i.e. what is it about a pop-up LOV that works differently?

Putting in a select is a problem as this is a staff list and it will be very long.

Thanks
Emma
  • 1. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    Patrick Wolf Employee ACE
    Currently Being Moderated
    Hi Emma,

    which APEX version are you using? And can you provide a simple test case on apex.oracle.com so that we also know what type of Popup LOV you are using. The test case will also allow us to edit it and show you what you have to do to set a value.

    Regards
    Patrick
    -----------
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf
  • 2. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    emma-apex Newbie
    Currently Being Moderated
    Hi Patrick

    I'm using 4.2.

    Can I infer from your reply that it is now possible to dynamically assign a value to a Pop-up LOV page item?

    Also do you know if it is now possible to dynamically assign a value to a select that uses Cascading LOVs (as I can't set to these either).

    Just knowing whether these things are possible or not would save me a lot of time.

    Thanks
    Emma
  • 3. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    Patrick Wolf Employee ACE
    Currently Being Moderated
    Hi Emma,

    I can confirm that both use cases should work. Do you use the "Set Value" dynamic action or do you directly use the $s JavaScript function?
    About the Cascading LOV. It you want to set a value after a cascading LOV has been refreshed, you have to listen for the "After Refresh" dynamic action event.

    Regards
    Patrick
    -----------
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf
  • 4. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    emma-apex Newbie
    Currently Being Moderated
    Hi Patrick

    I've created a pared down version of the app:

    http://apex.oracle.com/pls/apex/f?p=57627:40:105050427826168:::::
    demo/demo

    If you login and click to edit activity_id=34.

    Then find Parent task (which is :P41_PARENT_ID) and alter from Project 27 to Project 45. This should do two things via a dynamic action, set up like this:

    Event: Change
    Selection type: Item
    Item: P41_ACTIVITIES_PARENT_ID
    Condition: no condition


    Within this DA I have five true actions, of which this is the fourth (the first three all work). First, "Lead", which is a pop-up LOV, should now set to the activities_lead column of the new parent. Here is the DA setup:

    Action: set value
    When event is: true
    Fire on page load: no
    Stop execution on error: yes
    Wait for result: yes
    Set type: SQL statement
    SQL: select activities_lead from aa_wl_activities3 where activities_id=:P41_PARENT_ID
    Items to submit: P41_PARENT_ID
    Affected element type: Item
    Affected element item: P41_ACTIVITIES_LEAD

    At the same time, Cascade-from-status should set to show the word 'what'. This is a bit of a bodge as 'what' is not in the cascade's list of values, but the Page item Display Extra Values is set to Yes so the fact that the DA fails to set to 'what' still demonstrates the problem. (In the real app, the DA tries to set to a real value within the cascade list - I haven't done this here for speed.)

    This true action is the fifth in the sequence:

    Action: set value
    When event is: true
    Fire on page load: no
    Stop execution on error: yes
    Wait for result: yes
    Set type: SQL statement
    SQL: select 'what' from dual
    Items to submit: none
    Affected element type: Item
    Affected element item: P41_ACTIVITIES_CASCADE

    As you can see, Lead and Cascade both set to NULL.

    I have tried with many text fields to sort a workaround and have noticed something odd that might be relevant. If i set up a new page item for Lead as a text field, the DA will initially set it correctly. If I then change the source of the textfield to Database column and add another dynamic action to set the same textfield from a different trigger, the textfield will set to null when the original DA is triggered.

    The oddest bit of all this is that if i then strip out the second DA and Source = 'Database column', the textfield often stubbornly remains null when the DA is triggered, i.e. it's as though the field has become corrupted. I have checked this very carefully by taking screenshots and comparing new textfields that work against old ones that have stopped working and the config of the two page items are identical.

    I'm not sure how much help this will be but if you can offer any help I'd be grateful as I'm stumped

    Thanks
    Emma
  • 5. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    emma-apex Newbie
    Currently Being Moderated
    PS. I haven't tried the 'After refresh' tip yet - thanks for that, will try it now
  • 6. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    AnthonyRayner Pro
    Currently Being Moderated
    Hi Emma,

    Would you be able to provide the workspace credentials as well so we can login and take a look, I know you've been very descriptive in your message which is great, but for me it just helps to see the actual definition, if possible? Perhaps you could mail it to me, if that's ok? (anthony.rayner@oracle.com).

    Regards,
    Anthony.
  • 7. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    emma-apex Newbie
    Currently Being Moderated
    Update: cascade LOV now working (using After Refresh in DA) - thanks for that, Patrick. Setting value of pop-up LOV still not working.
  • 8. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    AnthonyRayner Pro
    Currently Being Moderated
    Emma,

    Regarding the Popup LOV and Set Value, unfortunately where the Popup LOV is 'non-enterable', the native action 'Set Value' is not sufficient by itself, and you need to do a little extra work. I will file a bug on this, but can suggest the following workaround.

    First, some quick background, (which helps to explain the workaround). The 'non-enterable' type renders 2 controls, to store the display and return values from the LOV. So say for an item called 'P1_POPUP', we render the displayed, disabled input called 'P1_POPUP' which shows the display value, and then also a hidden element called 'P1_POPUP_HIDDENVALUE' which stores the return value that is submitted. Currently, if you select 'Set Value' for the 'P1_POPUP', APEX internally will set the P1_POPUP_HIDDENVALUE field. 'Set Value' currently doesn't directly allow setting the display value.

    Now, to get around this, there are a few options. But I think the best way is to use an additional hidden item to temporarily store the display value, then have 1 action in your DA deal with setting the display and return values (display value stored in the additional hidden item, return value in the popup's hidden field. Then in a second action, the DA just copies the display value from the additional hidden item to the popup's display field. As follows:

    1) Create a hidden page item, that will be used to temporarily store the display value, called say 'P1_POPUP_DISPLAY'.
    2) Create a DA, with 1 'Set Value' action that gets the display and return values you want to set, perhaps with a type 'SQL Statement', then sets those to 'P1_POPUP_DISPLAY' and 'P1_POPUP' respectively. Then create another action of type 'Execute JavaScript Code', 'Affected Element' as 'P1_POPUP' and the following JS code:
    this.affectedElements.val( $v( "P1_POPUP_DISPLAY" ) );
    Hope that helps, and sorry this has stung you. Thank you for posting this.

    Regards,
    Anthony.

    Edited by: Anthony Rayner on May 1, 2013 1:56 PM
  • 9. Re: Apex 4.2: Pop-up LOV and dynamic actions - known bug?
    0186c429-d97a-481d-b68c-a4b1c8078119 Newbie
    Currently Being Moderated

    Hello Guys!

     

    I had the same issue and this topic helps me to find out the solution, thanks a lot! And by the way, any news about the bug fix??

     

    Best Regards Rogério

Legend

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