I have an APEX "select list" which is populated by a list of values SQL query. I'm trying to figure out how to have the select list selection result in more than one page item being set.
I have a single selection select list with a list of values set via a simple sql query.
ex:
page item name: P1_ITEM_ID
type: select list
page action on selection: Redirect and Set Value
list of values:
select item_desc, item_id from item_table order by 1;
With this configuration, a selection sets P1_ITEM_ID to the item_table's "item_id" value. However, assume "item_table" has additional columns, say "item_type" and "item_price", which I'd like to be accessible in session state as text fields (P1_ITEM_TYPE, P1_ITEM_PRICE) upon the select list selection. Any suggestions as to how I could do that?
One way to achieve this is by using a dynamic action. You can create a dynamic action that fires on the change event of your select list. The true action of the dynamic action can be set to execute PL/SQL code or JavaScript code that sets the values of the other page items based on the selected value of the select list.
For example, you could create a dynamic action with the following properties:
In the PL/SQL or JavaScript code, you can use the selected value of P1_ITEM_ID to query your item_table for the corresponding item_type and item_price values, and then set the values of P1_ITEM_TYPE and P1_ITEM_PRICE accordingly.