4 Replies Latest reply on Dec 11, 2012 5:22 PM by 560577

    Confirmation in DA before refresh of a PPR region


      I am working with an app that I am upgrading from v3.2 to and I have a page/region that had some javascript in it that I am trying to move away from manual JS and into dynamic actions.

      The region in question is a tabular form with PPR turned on and the problem I'm having is that I wish to check if any of the checkboxes are checked and if so, display a confirmation message to the user before the region paginates. I want that if the user does NOT press OK to the confirmation that the pagination is cancelled.

      So I have a DA as:
      1. Before refresh of my region
      2. Conditional based on javascript expression (I have my own JS on the region that checks if any checkboxes are checked and it does work for sure) that checks if at least one checkbox is checked.
      <script language="javascript" type="text/javascript">
      function verifyCheckboxes()
        var checkboxes=document.getElementsByName('f01');
        if (checkboxes==null)
          var vBoxChecked=false;
          for (var i=0;i<checkboxes.length;i++)

      3. If any are checked, prompt the user with the confirmation "are you sure you want to leave this page?". This action is defined as type "confirm".
      4. If the user presses cancel, the page should not continue.

      Steps 1-3 work fine. Step 4 doesn't happen...no matter what the user chooses (OK or cancel), the region paginates.

      I have worked with confirmations before on "before page submit" and it works like this...cancellilng in the confirmation box cancells the submission. I figured this would work similarly with "before refresh" of a region, but it does not.

      Is this an Apex bug that the confirmation OK/Cancel always allows the region to refresh (different behavior than with a confirmation used before page submit)?

      Ideas on another soution for what I'm trying to do?
        • 1. Re: Confirmation in DA before refresh of a PPR region
          Assuming that the "before refresh" is not stopped by that Cancel, how about you break things up into 2 DAs. Instead of
          in DA1, you set the value of some item.
          DA2 is set to run on the same event as DA1 but will be after DA1 and will refresh the region. However it will be conditional on the value set in DA1.
          Not 2 DAs(duh), you obviously need one to do the confirmation before the one that fires the refreshso my idea might not work unless you can use apex.confirm or something else in such a way that it will only set a value but not submit the page. Sorry.

          Edited by: Kofi on Nov 15, 2012 4:41 PM
          • 2. Re: Confirmation in DA before refresh of a PPR region
            Well I guess the situation is that "before refresh" fires after the signal to refresh the region has been heard by the server.

            In other words, when I paginate through the region, I click the link to paginate, it wants to refresh but encounters my DA that fires before the region actually refreshes. This is fine. My code fires correctly and prompts "are you really sure...?". Problem is, the answer from the confirmation is ignored (either OK or cancel permits the pagination to continue).

            When I've used a confirmation with a "before page submit" in this same manner, answering "cancel" to the confirmation would also abort the submit process.

            So I want the same sort of "cancel" action to abort the region refresh in this case, but seems like it's ignored.
            • 3. Re: Confirmation in DA before refresh of a PPR region
              I am now thinking this is a bug.

              In looking at Apex's help when you click on 'Action' in a DA, it says this about "Confirm":

              •Confirm - Displays a confirmation dialog. If the user chooses 'Cancel' then the proceeding actions are not executed and the current event is canceled.

              The bolded part above is what is not happening...the event is continuing.
              • 4. Re: Confirmation in DA before refresh of a PPR region
                FYI all...in case anyone runs across this. Oracle now has bug# 15916356 for this. I'm not sure when it'll be corrected though.