JavaScript Window.close method closes WebNow browser window when close method called from Lawson custom form viewed using DS Preview option But Not when viewing custom form through the Lawson 10.x Portal

Sort:
You are not authorized to post a reply.
Author
Messages
agersh
Veteran Member
Posts: 81
Veteran Member

    I added a button to the PO20.1 screen which opens an ImageNow WebNow browser window. I am able to determine if a browser window is already opened from a previous  OnClick event if the button is clicked again . If the button is clicked again or the PO20.1 screen is closed (or the user moves to another screen) I added the window.close method to the button OnClick event to close the current WebNow browser window before opening a new WebNow window, and the PO20.1 FORM_OnTerminate method to close the opened window. Determining if the window is open when the OnClick event is executed and the window.close method calls work when viewing my custom PO20.1 screen using the Design Studio View->Preview menu option. But when I view the form through are DEV/Test Lawson Portal the OnClick event only opens a new window the first time the event is executed. And the window.close method in the button OnClick event and PO20.1 FORM_OnTerminate method Do Not work. The following is the JavaScript from my custom PO20.1 screen. Anyone have an idea why the window.close method in the button OnClick event and PO20.1 FORM_OnTerminate method Do Not work when viewing the screen from the Lawson 10.x Portal?

     

    function BUTTON_OnClick(id, row)
    {
     if (id != "btn_image_now") {return true;}

      var imgURL = "";
      var myID = portalWnd.oUserProfile.getAttribute("id");

      imgURL = "http://inwebcontent/webnow/index.jsp?action=document&username=" + myID + "&viewname=AP";

      // Get PO Number field information from the screen
      var PONumber = myTrim(lawForm.getFormValue("text4",formState.currentRow));

     if (PONumber == "") {
        alert("Cannot link to ImageNow without a PO number on the form.");
        lawForm.positionInFieldById("text4");
        return;
     }
     

      imgURL = imgURL + "&field4=" + PONumber;

     if (typeof(imgWindow) == "undefined" || imgWindow.closed) {
        alert('No Img Window');
     }
     else {
        imgWindow.close();
     }

     imgWindow = window.open(imgURL,"POWindow","location=yes,menubar=no,resizable=yes,scrollbars=yes,titlebar=yes,toolbar=yes,status=yes");
     imgWindow.focus();

     return;
    }

     

    function myTrim(x) {
        return x.replace(/^\s+|\s+$/gm,'');
    }

     

    function FORM_OnInit()
    {
      var imgWindow = null;
    }

     

    function FORM_OnTerminate()
    {
      imgWindow.close();
    }

    You are not authorized to post a reply.