Redirect to new page in new tab after processing - Oracle Apex

1.4k views Asked by At

On button click I call process (eg. update table) and then call below code to redirect on new page in new tab (jasper report).

After processing > Branches > Page or Url redirect

javascript:window.open('fp= my_url_work_100% ,'_blank');

Nothing happens! Any idea where is problem!

What is best solution for redirect to new page in new tab after processing?

3

There are 3 answers

0
Littlefoot On

I don't know what is the best solution, but - to me, it seems that target URL is invalid. What is it supposed to represent?

  • fp= looks like beginning of Apex' URL, but - it begins with f?p= (note the question sign)
    • if you used it, then you'd navigate to another page in this application, but - why not using "Page in this application" target type, then?
  • however, you said that you want to open report (result of what Jasper Report returns)
  • if that's so, then URL should represent address of that report
    • I don't use Jasper Report, but - I do have Oracle Reports, and when calling such a report, address contains reports server name (the whole http://reports_server_address/reports/rwservlet/...). I'd expect that you should do the same

Maybe you should

  • create target URL (as part of process you mentioned) and store it into page item
  • then create branch which redirects to URL identified by that item
0
Koen Lostrie On

It's not possible to execute javascript in a branch. The branch is evaluated at the server side and will then redirect to the url identified in the branch. The string "javascript:window.open('fp= my_url_work_100% ,'_blank');" is not a valid url, it is a client side javascript call to open an url in a new tab.

A possible solution is to redirect to the same page with a specific page item value - or a REQUEST value and have a dynamic action to fire on load that execute the javascript call.

Another solution is to not use page processing/branch but a dynamic action and do the redirect in another action after the one that does the pl/sql processing.

0
user_odoo On

Thanks all for help, my solution is bellow.

Use modal page (page 2 in this example)

  1. When open modal page from page 1 I set P_ITEM = 0

  2. I have two button on modal page

BTN_PREPARE (call process preprare print send data to databse and set P_ITEM value = 1)

BTN_OPEN_JASPER (open jasper from dynamic action =>

javascript:window.open('f?p=&APP_ID.:1:&APP_SESSION.::::XXXXXXXXXXXXXXX','_blank');
  1. On page load I execute javascript code if P_ITEM = 1

$("#BTN_OPEN_JASPER").click();

  1. In inline css:

#BTN_OPEN_JASPER{ display: none;}

  1. When click on BTN_PREPARE submit page now P_ITEM = 1 and BTN_OPEN_JASPER is fire and open in new tab report!

Note:

I don't know is above example good solution but work!