Izik
Izik

Reputation: 958

Oracle apex value of item is not up-to-date in button link builder when using redirect to another page

I have a value of a field on page 1 that I need to pass to page 2 (modal dialog). The field is changed on page 1. and I can see it's got updated on the page and when I print its value in debug messages.

When I'm clicking the button, with the action "Redirect to Page in application", the value on page 2 is the initial value of the field, and not the updated one, is this a bug?

enter image description here

what can I do?

I don't want to use dynamic action or things like "prepare_url" because of many reasons. Thanks.

Upvotes: 0

Views: 2236

Answers (3)

Joe
Joe

Reputation: 1

You can also check after a modal window was closed using Koen's solution by creating a dynamic action with a dialog closed or cancelled dynamic action with a JS Expression selection type of 'window'.

Upvotes: 0

Thomas Tschernich
Thomas Tschernich

Reputation: 1282

As an alternative to Koen Lostries excellent explanation, in some cases it is also possible to have the target page load the item from the source page.

Ensure that the item is being pushed to the session, for example by using a dynamic action with the items to submit option, but do nothing else in this dynamic action. Then, when page 2 opens, simply add a pre-header-process, that makes something like :P2_ITEM := :P1_ITEM;

In my experience this approach is easier than doing a redirect in a dynamic action, as there is no declarative option for that and you often need hand-written javascript to do that.

Upvotes: 1

Koen Lostrie
Koen Lostrie

Reputation: 18695

That is not how a link works. What you are seeing is not a bug, it is expected behaviour. The link is rendered when the page is rendered and will have the item values at render time and a calculated checksum (depends on settings) based on those values. It will not pick up any changes.

The "traditional" way to do this is the following. Assumptions: Need to navigate from page 1 to page 2 and set P2_ITEM on page 2 to value of P1_ITEM on page 1.

  1. Create button (let's say button name is MYBUTTON) of type "Submit Page"
  2. Under "Processing", create a branch to page 2.
  3. For "Page or URL" pick page 2 and set P2_ITEM to value P1_ITEM.
  4. For "Process point" pick "After Submit"
  5. Under "Server Side Condition", select "MYBUTTON" under "When Button Pressed".

Since this is a branch your page has been submitted and all the changes you made to P1_ITEM will be picked up. The fact that page 2 is modal does not affect this, APEX will take care of that for you.

Upvotes: 4

Related Questions