1
votes

Working with APEX 3.2:

I want to show a confirmation popup on Page 2 when Page 1 has successfully been submitted. Right now I can get the text from the 'Process Success Message' to appear on Page 2, but instead of the 'Process Success Message' text, I want an alert popup. Any idea how to do that?

NOTE: I don't want to put javascript on the 'Submit' button of Page 1, because if there is a validation error, the alert popup will appear anyway every time the 'Submit' button is clicked. I just want the popup to appear only if Page 1 has successfully submitted.

1

1 Answers

1
votes

You could do this:

1) Edit the page template used by Page 2. Edit the Success Message subtemplate and put a span tag around the #SUCCESS_MESSAGE# placeholder like this:

<span id="successMessage">#SUCCESS_MESSAGE#</span>

2) Create some Javascript on Page 2 to run when the page is loaded that does this:

if ($x('successMessage')) alert ($x('successMessage').innerHTML);

The Success Message is only rendered if there is a success message to display, and so the alert will only happen when there is a success message to display also.

3) You could suppress the display of the success message on the page itself if you want by adding style="display:none" to the outer div of the Success Message subtemplate.

NB The template change will affect all pages that are based on it, not just Page 2, so you may need to take a copy of it first. You could include the Javascript in the page template so that you don't need to keep adding the same on load Javascript to each page.