Oracle Apex: Dynamic Action Execute JavaScript Code Example

In this tutorial, you will learn how to create dynamic action in Oracle Apex to execute JavaScript code.

In the following example, I have two text fields on my page, one is a Value A and another is a Value B. I have created a dynamic action on Value B field to validate that Value B should be greater than or equals to Value A. To do this task, follow these steps:

Creating Dynamic Action to Execute JavaScript Code

Do the right-click on the Value B field and select Create Dynamic Action from the menu.

Select Event as Lost Focus and Action as Execute JavaScript Code.

Then add the following JavaScript code in the Code field:

if ($v('P39_VAL_B') < $v('P39_VAL_A')) {
    apex.message.alert('Value B should be greater than or equal to Value A.');

The following is the screenshot for the above settings:

Oracle Apex: Create dynamic action to execute JS code.

Now save the changes and run the page to test. The output would be as following:

Execute JavaScript code dynamic action.

Related Tutorials:

Leave a Comment