Scott Hillier
Scott Hillier

Reputation: 31

Apex, Dynamic action, Confirm action, not picking up correct text - what am I missing?

I'm obviously missing something and hoping someone might be able to help.

I've an Interactive Grid, and a button.

When the button is pressed the dynamic action on the button has 2 steps.

Action 1 - Execute Javascript to take a value from one of the IG cells and put it into a page item.

Action 2 - Confirm Action - Are you sure you wish to delete &P10_JOB_ID.

I've made the page item, &P10_JOB_ID, visible and I can see the value has correctly been changed to the value from the IG.

I write P10_JOB_ID into a database table - I get the correct value

But the confirm message isn't picking up the correct value from P10_JOB_ID.

Namely it uses the value in P10_JOB_ID when the page starts, but then as I move around the IG pressing the button and changing the value of P10_JOB_ID, the text in the confirm message never changes.

Can anyone suggest what I might have missed, I'm baffled.

Thanks a lot

Upvotes: 1

Views: 1835

Answers (2)

Scott Hillier
Scott Hillier

Reputation: 31

Ok - having the setting of value and confirm as 2 separate actions is what causes the problem.

As per fac586

That is the expected behaviour. Static text substitutions are performed once during page show processing. They are not evaluated dynamically in the browser at runtime as values change.

Drop the second action and extend the first to display the confirm dialog using the apex.message.confirm JS API method, accessing the item value using the $v shorthand method.

Upvotes: 0

Tony Andrews
Tony Andrews

Reputation: 132570

Substitutions like &P10_JOB_ID. are made when the page is rendered, not dynamically, so reflect the value at time of page load.

You will need to use Javascript to perform the conform action, something like:

apex.page.confirm ('Are you sure you wish to delete ' + $v('P10_JOB_ID') + '?', 'DELETE');

$v is an APEX Javascript function that returns the current value of a page item.

I used 'DELETE' as an example of a request value; you may want to do something different here.

Upvotes: 2

Related Questions