darkvarK
darkvarK

Reputation: 89

How to set conditional confirmation action in dynamic action using value from APEX_APPLICATION.G_F10(1) function

I have to make a process which will link two IDs from two different tables when button is clicked. Before, process executes, I have to check if amounts in records are identical. If yes, make a link, if not ask user for confirmation and then if user confirms, link IDs.

Two tables are displayed in two interactive report regions, and every row has radio button. Radio buttons are made with APEX_APPLICATION.G_F10(1) and APEX_APPLICATION.G_F20(1) functions.

User checks radio button in left and in right region and then clicks on "LINK" button. Then dynamic action is triggered and this is what it does:

  1. Asks the user to confirm linking IDs
  2. Submits the page and runs the process with procedure for linking

Between 1 and 2 I need to check if amounts related to left and right ID are the same. If they are, run the process. If not, ask once more and after yes answer, run the process.

I create validation for process, but when amounts are not the same it prevents process to run at all.

I tried to create another action between 1. and 2. to execute PL/SQL to check are the APEX_APPLICATION.G_F10(1) and APEX_APPLICATION.G_F20(1) equall, but I am getting error that "no data found".

I guess, that DA can't tell what is the value of APEX_APPLICATION.G_F10(1) and APEX_APPLICATION.G_F20(1).

Honestly, I guess that some javascript could solve the problem, but have no idea what I can try next.

enter image description here

Upvotes: 1

Views: 1374

Answers (1)

Goran Kutlaca
Goran Kutlaca

Reputation: 2024

Your problem is that APEX_APPLICATION.G_F10 and APEX_APPLICATION.G_F20 can't be referenced in dynamic actions, they can only be referenced in code that you place after page submit.

Since you have to check their values for second confirm (before submit), you'll have to fetch their values using JavaScript.

Since HTML doesn't change momentarily for checked radiogroup items, I'd recommend you either to

  1. write JavaScript function that would either add checked attribute to HTML of clicked radiogroup element
  2. or fill some page item with clicked value.

Then you call that JavaScript function through p_onchangeparameter od APEX_ITEM.RADIOGROUP.

If you added checked attribute, than you can stroll through HTML of both regions on button click and find those input HTML elements that are of [type="radio"] and have checked attribute.

If you filled page items with values, you can compare those values directly through those items in simple PL/SQL code in dynamic action.

I hope I helped! If you'll need more help, feel free to ask.

Upvotes: 1

Related Questions