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:

Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.