Skip to Main Content

Run Dynamic Action from JavaScript

An elegant solution for running a DA from JS by Jeff Eberhard

"I don't remember the use case but I do remember a time needing to call a Dynamic Action from some JavaScript code. It may have been a situation where I wanted to execute some database code from JavaScript and thought it might be easier to put all that code in a Dynamic Action vs. the method of using AJAX to call an Application Process."

More info and an example: http://www.eberapp.com/pls/apex/f?p=BLOG:READ:0::::ARTICLE:1695400346724960.

Synchronous and Asynchronous

A nice article on this subject: https://apex.oracle.com/pls/apex/germancommunities/apexcommunity/tipp/5741/index-en.html

In Application Express 5.0, only dynamic actions with their Wait for Result attribute set to No would execute in asynchronous mode, otherwise execution is synchronous. Starting with Application Express 5.1, dynamic actions will generally be executed in asynchronous mode. That means, that a dynamic action, which executes an AJAX request to the server, does not block the browser any more. Subsequent dynamic actions can start immediately - while the AJAX request is running. A dynamic action does an AJAX request, when it executes SQL queries or PL/SQL code in the database. With this change, Application Express follows best practice in web application development - asynchronous AJAX requests lead to much better user experience, since the page remains responsive when AJAX requests are running.

Validations for Dynamic Actions

For a method to run validations using a Dynamic Action, see my Validations page.