Matt W
Matt W

Reputation: 105

Dynamically Changing Value in APEX Based on Select List Selection

I currently have a select list with the values: 1, 2, 3, 4 & 5. These correspond to a column in table "DVD" called "DVDID", and these are the only values in this column in the table.

In the table "DVDCOPY" records exist containing the all DVDIDs (1,2,3,4,5) with a different DVDCOPYID.

E.g. a record from the DVDCOPY table is:

DVDCOPYID DVDID DISCCONDID
1         1     1

My question is, how can I make it so that once a DVDID is selected from the select list, the DVDCOPYID changes dynamically based on this selection? E.g. once 1 is selected in the DVDID select list, the value for DVDCOPYID also changes to 1 automatically.

My form currently looks like this, if this helps: APEX Form

Upvotes: 1

Views: 4669

Answers (1)

Thomas
Thomas

Reputation: 203

You have to use dynamic actions and PL/SQL. Create a hidden form element which allows for element changes (no session protection enabled). Create a new dynamic action in your form guiding to the select list and using the onchange event. Your dynamic action contains two steps: first set the hidden form element to the value of your select list. Second: execute a PL/SQL statement (UPDATE DVDCOPYID SET ... = :NEW_HIDDEN_ELEMENT WHERE ID = ...).

Upvotes: 1

Related Questions