Forum Stats

  • 3,770,079 Users
  • 2,253,061 Discussions
  • 7,875,301 Comments

Discussions

How to make Popup LOV submit selected value so that it can be accessible in the session?

AllenS.
AllenS. Member Posts: 72 Blue Ribbon
edited Nov 25, 2021 8:28AM in APEX Discussions

Hi,

I created a Popup LOV (ie. P1_COUNTRY) and a button that opens a Dialog page and supposedly passes the value of the Popup LOV item. I noticed that when I click the "Session" button at the bottom to see the value of the page items, the P1_COUNTRY item is set to null. So I'm when I pass the value via Redirect to Page in Application, it also passes a null because it doesn't submit the value yet.

Is there anyway to make the Popup LOV submit upon selection of an item in the list?

We are currently using APEX 18.2 and company is neglecting to upgrade yet since everything is still working.

Appreciate any feedback.

Tagged:

Best Answer

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,128 Red Diamond
    Accepted Answer

    In this situation my solution would be to access the required value(s) from session state rather than passing them as URL parameters.

    I'm making some assumptions:

    • All items maintain session state Per Session (disk)
    • The dialog page is page 2
    • Page 2 is only called from page 1

    We can then proceed as follows:

    • Remove P2_COUNTRY from the Set Items list on the button that opens the dialog.
    • Set the Source properties for P2_COUNTRY:
      • Type: Item
      • Item: P1_COUNTRY
      • Used: Always, replacing any existing value in session state
    • Add a Change dynamic action to the P1_COUNTRY item:
      • Action: Execute Server-side code
      • Language: PL/SQL
      • PL/SQL Code: null;
      • Items to Submit: P1_COUNTRY

    If the dialog is reused across multiple pages then a slightly different approach would be required, using a Before Regions process or computations to set P2_COUNTRY from the possible source page values rather than the Source properties.

    AllenS.SmithJohn45

Answers

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,128 Red Diamond
    edited Nov 26, 2021 11:51AM

    This question is being asked with increasing frequency. It is relatively complicated to do this because opening modal dialogs requires the calculation of a checksum, and this can only be done on the server using session state values. It seems that Oracle failed to anticipate use cases where modal dialogs would be opened depending on data values that are not in session state.

    However, it is also the case that I have only encountered this problem once in my own development, and that where I was following a requirement to match and reuse existing functionality created by another developer. This suggests that Oracle and some experienced developers consider this situation to be an anti-pattern and take an approach to the overall design of the application UI/UX that avoids it occurring.

    To try to understand this better, can you explain:

    • The purpose of the calling page and the target dialog page.
    • Why the dialog is dependent on the P1_COUNTRY item?
    • Why the P1_COUNTRY item is located on the calling page and not in the dialog?
  • AllenS.
    AllenS. Member Posts: 72 Blue Ribbon
    edited Nov 26, 2021 3:05AM

    Hi,

    Thanks for taking the time to respond.

    Regarding my use case, I have a master -detail page. On the region above, I have Popup LOVs and text fields. Then another region at the bottom which is a Interactive Report used for listing detail records. I have a button on this region for adding more detail records which opens up a another page where you can enter more info of this detail record. However, this detail page also has an interactive report which is supposed to be filtered based on the chosen country on the master detail page. Then this interactive report on the detail page has a checkbox where the user can select multiple records which will basically be added to the detail report on the master-detail page.

  • fac586
    fac586 Senior Technical Architect Member Posts: 20,128 Red Diamond
    Accepted Answer

    In this situation my solution would be to access the required value(s) from session state rather than passing them as URL parameters.

    I'm making some assumptions:

    • All items maintain session state Per Session (disk)
    • The dialog page is page 2
    • Page 2 is only called from page 1

    We can then proceed as follows:

    • Remove P2_COUNTRY from the Set Items list on the button that opens the dialog.
    • Set the Source properties for P2_COUNTRY:
      • Type: Item
      • Item: P1_COUNTRY
      • Used: Always, replacing any existing value in session state
    • Add a Change dynamic action to the P1_COUNTRY item:
      • Action: Execute Server-side code
      • Language: PL/SQL
      • PL/SQL Code: null;
      • Items to Submit: P1_COUNTRY

    If the dialog is reused across multiple pages then a slightly different approach would be required, using a Before Regions process or computations to set P2_COUNTRY from the possible source page values rather than the Source properties.

    AllenS.SmithJohn45