I have buttons on my apex application that executes custom PL/SQL codes upon being clicked. They have names APPLY (Acknowledge) and CHANGE (Count Correct). I need to have it so that when APPLY is clicked, it redirects to the same page (with the PL/SQL code implemented) and when CHANGE is clicked, it redirects to another page (with PL/SQL code implemented).
I tried setting a conditional branch for After Processing by way of "When Button is Pressed" and/or "Condition Type: Request = Expression 1" with the value of Expression 1 equaling "APPLY" or "CHANGE". I can't produce the results I am looking for (frustratingly) this way. APEX says that the submitted page Request takes on the name button that is clicked (i.e APPLY when APPLY is clicked) but I can not get that to happen.
I am now seeking to add a True Action to my Dynamic Actions for APPLY and CHANGE (which are currently "Execute PL/SQL Code" and "Submit Page" for each) which executes a Javascript Code redirecting to the desired page in the application.
The code, i think, would utilize something like this
"apex.navigation.redirect('f?p=928:35:4081364075246::NO:::');"
page 35 is the page I'd like the CHANGE button to redirect to, in this case.
I'm not as versed in JavaScript as I'd like to be, so any help with my methodology on any of this would be appreciated.
I have buttons on my apex application that executes custom PL/SQL codes upon being clicked. They have names APPLY (Acknowledge) and CHANGE (Count Correct). I need to have it so that when APPLY is clicked, it redirects to the same page (with the PL/SQL code implemented) and when CHANGE is clicked, it redirects to another page (with PL/SQL code implemented).
I tried setting a conditional branch for After Processing by way of "When Button is Pressed" and/or "Condition Type: Request = Expression 1" with the value of Expression 1 equaling "APPLY" or "CHANGE". I can't produce the results I am looking for (frustratingly) this way. APEX says that the submitted page Request takes on the name button that is clicked (i.e APPLY when APPLY is clicked) but I can not get that to happen.
I am now seeking to add a True Action to my Dynamic Actions for APPLY and CHANGE (which are currently "Execute PL/SQL Code" and "Submit Page" for each) which executes a Javascript Code redirecting to the desired page in the application.
The code, i think, would utilize something like this
"apex.navigation.redirect('f?p=928:35:4081364075246::NO:::');"
page 35 is the page I'd like the CHANGE button to redirect to, in this case.
I'm not as versed in JavaScript as I'd like to be, so any help with my methodology on any of this would be appreciated.
Share Improve this question edited Jan 21, 2015 at 18:24 Vadim K. 2,44619 silver badges27 bronze badges asked Jan 21, 2015 at 18:11 KevinKevin 2072 gold badges4 silver badges12 bronze badges 3- If you want a conditional branch, I would use a Branch with a condition based on the Request. If this is not working for you, I would first determine why (e.g. is the sequence of branches in the correct order?). – Jeffrey Kemp Commented Jan 22, 2015 at 3:48
- I tried many times to figure this out. Using one branch after processing (for testing) I set the branch to redirect to the desired page at Request = APPLY. However, it seems to not work because when I click the button it stays on the same page. I tried taking off the 'Submit Page' Dynamic action as well, which resulted in the PL/SQL code firing correctly (shown if you refresh the page and see the changes) but no page redirection at all. – Kevin Commented Jan 22, 2015 at 12:46
- It's still not clear why you need any dynamic action at all. – Jeffrey Kemp Commented Jan 23, 2015 at 1:42
3 Answers
Reset to default 6I finally found out how to do this. The Request of the button (specifically the dynamic action of the button) was not set to the button name because the 'Request/Button Name' of the 'Submit Page' true action was not set to the name of the button.
Make sure in the dynamic action to add this information under 'Settings'. The branch should be placed to 'Submit: before Processing' with the condition 'Request = Expression 1' with Expression 1 equaling the button name!
In a recent project, I needed to do a page redirect once the user clicked the Save button on a model page. The button had a Dynamic action that included 3 separate actions:
- Execute PL/SQL
- Submit Page
- Close Dialog
In between the Submit Page
and the Close Dialog
, I added an Execute Javascript
action that clicks a hidden button that I added to the page.
document.getElementById("BTN_ID").click();
The hidden button was set to redirect the user in Behavior -> Action -> Redirect to Page in Application, and the page #
.
I hid the button with #BTN_ID{visibility:hidden;}
placed in the CSS Inline section of the page.
This worked.
Here's how I solved a similar situation: I wanted the DELETE button on page 2 to perform deletes on other tables, in addition to deleting the row displayed, and then return to page 1:
- Deleted the existing DELETE button.
- Created new button with: Button Name=DELETE, Label=Delete, Action=Submit Page.
- Created an After Submit Process Branch with: Name=Delete and Return to Page 1, Execute Point=After Submit, Behavior Type=Page or URL, Target=Page 1, Advanced Request=DELETE, Server Side Condition=When Button Pressed=DELETE, Type=PL/SQL Function Body,
then PL/SQL FUNCTION BODY:
declare
lv_msg varchar2(2000) := null;
begin
pz_delete_related_records(:P2_KEY1, :P2_KEY2, lv_msg);
DELETE FROM BASE_TABLE
WHERE KEY1 = :P2_KEY1
AND KEY2 = :P2_KEY2;
RETURN TRUE;
end;