简体   繁体   中英

Oracle APEX button - link to URL and execute dynamic action

I am working with APEX 20. I defined a button which links to a URL: Behavior: "Redirect to URL" and my URL as Target - this works without any problem.

When this button is pressed, I have to change the status in a table in my data model. I added a Dynamic Action which executes some PL/SQL code to update my table.

The problem is that when the button is pressed, the redirect is done and my dynamic action is not executed.

Is there any way to change the sequence, executing the dynamic action first, and then the redirect?

Some background: This application allows users to define + configure systems and queue them for automatic installation. The installation is done from a remote server, and must be triggered by calling a CGI script per URL. When the order is issued, the user should come back to the applications main page to work on other systems.

Therefore I choose a modal dialog to launch the order. The idea is:

  • On the system page press button "Install"
  • Modal dialog page opens Here you press the usual "Do you really wish to install" button (since it will cost money now).
  • At this moment the status in the database must be altered, and the redirect to the URL must happen.
  • The modal dialog closes and the user is back on the system definition pages.

I tried to connect the button only with the dynamic action to update the database table, followed by a "submit" action. In this scenario I added a branch to the URL to be processed after page submit, which did not work.

I also tried to intergrate the redirect to the URL into the PL/SQL code using apex_util.redirect_url, but I do something wrong, this part is simply ignored.

What you could try is:

  • Make the button with action "Submit Page"
  • Create a page process in the with point "Processing". This is where you'd execute the code to update the table. Add a when button pressed server sided condition.
  • Create a branch to redirect to the new page after submit with the same when button pressed server sided condition.

This is "the traditional" way of doing it in APEX - handle all database actions after page submit. No dynamic actions are needed in this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM