4 Replies Latest reply: Feb 7, 2013 4:19 AM by Rambo79 RSS

    Creating a pop up window on button click?

    Rambo79
      Hi

      How would I create a pop up modal window when a user clicks on a print button within an interactive report. This window would then display a message with a confirm or cancel button. If they click on confirm the page prints out and if they click cancel it takes the user back to the report

      Is this possible? if so how is this achieved?

      Many Thanks
        • 1. Re: Creating a pop up window on button click?
          Denes Kubicek
          You should use Modal Plugin:

          http://apex-plugin.com/oracle-apex-plugins/dynamic-action-plugin/skillbuilders-modal-page_138.html

          It has a good documentation on how to get it working. Your requirement should be ok with that.

          Denes Kubicek
          -------------------------------------------------------------------
          http://deneskubicek.blogspot.com/
          http://www.apress.com/9781430235125
          http://apex.oracle.com/pls/apex/f?p=31517:1
          http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
          -------------------------------------------------------------------
          • 2. Re: Creating a pop up window on button click?
            Rambo79
            Hi

            I would not rather use plugins if possible so I have came across the following, could any experts explain what this code is doing. Would I just create a new page in apex with a confirmation message with a print and cancel button and place the URL in the code below where they are referencing the apex pages?

            Or could I just use the code below and where is states ok - it would initiate a print and if you clicked on cancel it would just return you back to the screen

            var r=confirm("Press a button");
            if (r==true)
            {
            x="You pressed OK!";
            }
            else
            {
            x="You pressed Cancel!";
            }
            • 3. Re: Creating a pop up window on button click?
              Tom Petrus
              The confirm dialog is a native dialog in the browser. It will display a message and it has an ok and cancel button. Running it in javascript will prompt the user with the dialog, and the return value will be true or false depending on the button clicked.
              You don't need any extra page whatsoever.
              var r=confirm("Press a button");
              if (r==true)
              {
              x="You pressed OK!";
              }
              else
              {
              x="You pressed Cancel!";
              }
              This would prompt you with a small dialog, asking "Press a button.". Clicking Ok or Cancel will return true or false to variable r, which in this code is then tested.
              You could shorten it up to
              if(confirm("Do you want to print?")){
                 //execute print code
              };
              Alternatively, if you are on version 4.0 or higher you can use a dynamic action for this. Set the action to fire on the click of a button, and as a true action you can choose the confirm action, which then lets you display a text.
              • 4. Re: Creating a pop up window on button click?
                Rambo79
                Thanks

                I have implemented the following as a dynamic action

                onclick="window.print();"


                Which works great, but what is the best way to integrate this with an oracle printing engine like fopp where the data in the form is overlayed in set positions on a piece of pre printed stationary

                Edited by: Rambo79 on 07-Feb-2013 02:17