oracle-apexoracle-apex-19.2

Dynamically insert data into an APEX page item when a page item is entered a value


I have a form in APEX that is used to add data into a table. Most of the items in the form are free form texts but there few items that are needed to auto filled when you enter a value in on of the page item.

For example.

There is form with Page Items. ID, Name, TitleLevel, Title_prefix, Salalry,

There is a table XYZ with Title_prefix and salary info which

ID Title_prefix Salaray

1 Junior 80000

2 Mid-Level 95000

3 Senior 115000

So you enter ID= 1, Name = ABCD, Titlelevel = 6 is entered and Title_prefix and salary should be populated based on the value that is entered in titlelevel. In this case it will be

Title_Prefix = (SELECT Title_Prefix FROM XYZ WHERE ID = (Case WHEN :P1_TitleLevel > 5 THEN 3 CASE WHEN :P1_TitleLevel = 5 THEN 2 ELSE 1 END))

Same thing for Salary as well.

Immediately after entering Titlelevel page item to 6 the Title_prefix and Salary should get refreshed and populate this items. Then the user will submit the form so that the information can be entered into the table.


Solution

  • Add a Dynamic Action on titlelevel (Key Release if Text Field, onChange if dropdown etc.)

    Add a PL/SQL Action to the dynamic_action, using Items to Submit to pass fields in and Items to Return for the fields you modify.

    Dynamic Action: enter image description here

    OR enter image description here

    Action: enter image description here