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:
Now save the changes and run the page to test. The output would be as following:
Related Tutorials:
- Oracle Apex: Calculate Field Values Using JavaScript
- Oracle Apex: Format Number with Comma and Decimal Using JavaScript