Redirect user to different page in APEX is tricky some times. I have tried to use button and branch to page but did not have good luck in one of my application. It works in one case but does not work in another. I had mess around with the branch at different point but did not work.
Finally I have done this using simple jQuery and javascript. It is not only the page redirection but also I wanted to pass primary key parameter to the new page.
Below is the pop up screen and I wanted to redirect user to the camping page as soon as they select “CAMPING” option from the drop-down list.
I have done this in Oracle APEX 3.2 and unfortunately this version of APEX does not have jQuery plugin installed. So I have to include the jQuery library manually in the header section of the page.
<script src="/i/themes/calm/jquery-1.4.2.js" type="text/javascript"></script>
If you don’t the jQuery library downloaded then head up to http://www.jquery.com to download the library.
Here is the simple jQuery function to redirect user to different page on select list change event –
< script type = "text/javascript" > $(function() { $('#P203_ACTIVITY_NAME').change(function() { var ac = $('#P203_ACTIVITY_NAME').val(); //alert(ac); if (ac == 'CAMPING') { window.location = 'f?p=&APP_ID.:202:&SESSION.::&DEBUG.::P202_SIT_ID:&P203_SIT_ID.'; } }); }); < /script>
In the above code I have formatted the URL pro-grammatically so that it will get the application id, session id etc. I am also setting the page item value of :P202_SIT_ID with the current page item value with the current page item value.
f?p=&APP_ID.:202:&SESSION.::&DEBUG.::P202_SIT_ID:&P203_SIT_ID.
Whenever user select “Camping” from the activity list, they will be redirected to another page to enter further information. In the new page then I have created PL/SQL script to create “Camping” activity on update process in the new page.
Hope this will help someone to work around with page redirection.
Could please explain little more. I am facing the same problem. Where did you added jquery & how ?
Hi Thirumal,
What kind of problem are you facing? Please share your code here to check.
Cheers,