4 Replies Latest reply on May 2, 2008 12:58 PM by 565262

    Close popup not working

    565262
      Hi,

      I have several popups in my app which are called in exactly the same way and have a process to close them that are exactly the same (which runs when a 'cancel' button is pressed). While most of these work fine one of my popups does not close when the cancel button is hit. I really can't see any difference in the processes or how they are called. I even copied the 'close popup' process from the page that works to the one that doesn't and also tried removing all conditions (including when 'cancel' is hit) and it still doesn't work. Could there be some difference in the set-up of the page that may be causing it to work in some pages or not others? I'm really stuck!

      Here is the process, it is set to run On submit - after computations and validations.

      BEGIN
      --closes this popup window
      htp.p('<body>');
      htp.p('<script type="text/javascript">');
      htp.p('alert("hello");');
      htp.p('window.close();');
      htp.p('</script>');
      htp.p('</body>');
      END;

      Thanks!
      Lucy
        • 1. Re: Close popup not working
          Luis Cabral
          Hi

          I thought that htp calls only worked during page rendering. Using it in a on submit process should have no effect... Are you sure this works for the other pop-ups? Can you provide more details?

          Luis
          • 2. Re: Close popup not working
            565262
            Ok, this is really frustrating me, I still haven't solved the issue. Here is what I am doing, for both the cases on which the 'close popup' process doesn't work (A) and on which the 'close popup' process works (B). Who can spot the difference?

            -----------------

            The popup is called using the following function
            A: javascript:custom_PopUp('f?p=&APP_ID.:30:&SESSION.::&DEBUG.::P30_PREV_PAGE:4','Specimen record',900,700,'yes','yes');
            B: javascript:custom_PopUp('f?p=&APP_ID.:64:&SESSION.::&DEBUG.:64:P64_DICT_NAME:IMAGE_PROPERTIES','Add new image property',320,320,'no','yes');

            Where this function is defined as:
            function custom_PopUp(pURL,pName,pWidth,pHeight,pScroll,pResizable){
            if(!pURL){pURL = 'about:blank'}
            if(!pName){pName = 'Popup'}
            if(!pWidth){pWidth = 600}
            if(!pHeight){pHeight = 600}
                 if(!pScroll){pScroll = 'yes'}
                 if(!pResizable){pResizable = 'yes'}
            l_Window = window.open(pURL,pName, 'toolbar=no,scrollbars='+pScroll+',location=no,statusbar=no,menubar=no,resizable='+pResizable+',width='+pWidth+',height='+pHeight);
            if (l_Window.opener == null){l_Window.opener = self;}
            l_Window.focus();
            }

            Cancel button properties:
            A: Button displayed amongst items; name: 'CANCEL'; Submit as 'CANCEL'; Optional URL redirect: No target; No database action.
            B: Button displayed amongst items; name: 'CANCEL'; Submit as 'CANCEL'; Optional URL redirect: No target; No database action.

            Close popup process:
            A: On submit, after computations and validations.
            BEGIN
            --closes this popup window
            htp.p('<body>');
            htp.p('<script type="text/javascript">');
            htp.p('window.close();');
            htp.p('</script>');
            htp.p('</body>');
            END;

            Conditions: Value of Item in Expression 1 = Expression in Item 2; Expression 1= P30_PREV_PAGE; Expression 1= 4 (I have checked that this second value is in the cache). On button press = CANCEL.

            B: On submit, after computations and validations.
            BEGIN
            --closes this popup window
            htp.p('<body>');
            htp.p('<script type="text/javascript">');
            htp.p('window.close();');
            htp.p('</script>');
            htp.p('</body>');
            END;

            Conditions: On button press = CANCEL.

            -------------

            The only obvious difference I can see is that in case A (where the popup doesn't close) there is an extra condition, but I have checked that this is in the cache and I have also removed this condition and it still doesn't work.

            Does anyone have any suggestions as to why the close popup process works in case B but not case A?

            I greatly appreciate your help!
            Lucy
            • 3. Re: Close popup not working
              565262
              Hi there, this closing popup problem is driving me up the wall. I cannot find why it will work on one page and not the other. Please, if you have any ideas put them forward!

              The latest thing I have tried is to put "javascript:window.close();" in to the button 'optional url redirect'. This works great for the cancel button, but obviously I can't do that on an 'OK' button as I want it to perform some processes. So I created a page branch with the condition for button press='OK' with exactly the same "javascript:window.close();" in the URL redirect and it does not shut the window, returning me "ERR-1777: Page 30 provided no page to branch to.".

              Does anyone have any ideas as to why this javascript works fine when run from the button, but not from the page branch?

              Thanks
              Lucy
              • 4. Re: Close popup not working
                565262
                OK, sorted it! For some reason if you have any page branches that the page could possibly take (i.e. either an unconditional one or one that meets the conditional criteria) then they override the process containing the "javascript:window.close();" even though this process supposedly occurs before the page branch.

                If anyone can explain why, I'd be grateful, but at least I've got it sorted now!