Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with dialog window.

    Hello,

    I have a problem with Modal dialog window. If a submit starts to execute by a onchange of a combobox, the user could click on a href of opening a dialog window which is causing problems, although I have tried in the onchange to disable the href as the first thing.
    So I changed it to a image like the following (which I can make invisible before the submit starts):
    Code:
    <input type="image" name="img_NormPopup" style="border: 0px solid;" src="/images/img_selecteer.gif" onclick="javascript:disabled=true;OpenNormPopup();">
    But the problem is now:
    1. If I don't write: onclick="javascript:disabled=true;, then the dialog window closes after 15 seconds automatically
    2. But if I write: onclick="javascript:disabled=true; and the dialog window is closed by the window close in the titlebar (red cross), the image button on the opener is still disabled.
    3. I have tried a lot but I could not disable the href while the submit was start to execute.
    Code:
    <a href="javascript:OpenNormPopup();" ><img name="img_NormPopup" onclick="javascript:disabled=true;" src="/images/img_selecteer.gif" border="0" alt=" Selecteer norm "></a>
    Has anybody an Idea why this behaves the way I just discribe. And has anybody a idea how to solve this.

    Beneath is the rest of my code.

    Nico

    Then the function NormPopup call open the dialogwindow:
    Code:
    function OpenNormPopup()
    {
      var frm=document.frmFormulier;
      var lPRCT_id;
      if (document.all('A_tmp_PRCT_id') != null)
      {
        lPRCT_id=frm.A_tmp_PRCT_id.value;
      }
      else
      {
        lPRCT_id=frm.A_PRCT_id[frm.A_PRCT_id.selectedIndex].value;
      }
      switch (frm.A_BDRE_id[frm.A_BDRE_id.selectedIndex].value)
      {
        case '-2' : 
          lBDRE_id='PRSN';
          break;
        case '-3' : 
          lBDRE_id='BDRF';
          break;
        default : 
          lBDRE_id=frm.A_BDRE_id[frm.A_BDRE_id.selectedIndex].value;
          strBDRE=frm.A_BDRE_id[frm.A_BDRE_id.selectedIndex].text;
          break;
      }
      openModalWin('../../OVERALL/info_popup_selecteernorm.asp?From=OG&PRCT_id='+lPRCT_id+'&BDRE_id='+lBDRE_id + '&TGeb=N', 0.95*screen.availWidth,0.95*screen.availHeight, 'yes');
    }
    And this is on the end the function which really executes to open the modal dialog:
    Code:
    var dialogWin = new Object()
    function openModalWin(url, width, height, scrollbars) {
      if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
      // Initialize properties of the modal dialog object.
      dialogWin.url = url
      dialogWin.width = width
      dialogWin.height = height
      // Keep name unique so Navigator doesn't overwrite an existing dialog.
      dialogWin.name = (new Date()).getSeconds().toString()
      // Assemble window attributes and try to center the dialog.
      // The best we can do is center in screen.
      dialogWin.left = (screen.width - dialogWin.width) / 2
      dialogWin.top = (screen.height - dialogWin.height) / 5
      var attr = "left=" + dialogWin.left + ",top=" +  dialogWin.top + ",resizable=no,scrollbars=" + scrollbars + ",width=" + dialogWin.width + ",height=" + dialogWin.height
    				
      // Generate the dialog and make sure it has focus.
      dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr)
      dialogWin.win.focus()
      } else {
        dialogWin.win.focus()
      }
    }

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,968
    Thanks
    0
    Thanked 236 Times in 233 Posts
    If you are only supporting IE as the browser which I can see as you use document.all, then you might as well use IE's window.showModalDialog method.

  • #3
    New Coder
    Join Date
    Mar 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, it's a dedicated application and only the IE is used. Just a hour ago I have changed the function window.showmodaldialog(url). First it looks good, but it's a popup window and you can select a record by a href. The href is calling a JS function in the opener (parent) window to fill some fields in the parent window and after this the dialog popup window is closed. But this give new problems because the function in the popup window called by opener.selectnorm(arg1, arg2) doesn't work. On that moment a new window is opened with the error message the page could not be found.

    In the meantime I have investigated that automatically closing of the popup within approx. 15 sec. it's due to the type "image". If I make the type for example "button", then the popup stays open. But then the figure is not good which we use to call a popup in the application.

    Has anybody a Idea why the popup stays open if the type is button?

    Nico

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,968
    Thanks
    0
    Thanked 236 Times in 233 Posts
    If you are using showModalDialog, there is no opener window. If you want to access the window that opens the dialog, you need to pass the window object of that window to the dialog when opening it.

    main page:
    Code:
    var ret = showModalDialog(url, window, "dialogHeight:500px; dialogWidth:400px;");
    dialog page;
    Code:
    var openerWin = window.dialogArguments;
    openerWin.functionInTheOpener();
    More info on showModalDialog: http://www.webreference.com/js/tutorial1/dialog.html

  • #5
    New Coder
    Join Date
    Mar 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    Yesterday I have solved my problem. To call up the popup window I do it with a object type="button" and in de CSS I have defined a class
    ".button_popup" with some attributes but the most important two are:
    - the background is the image which we use to call up the popup window
    - transparent.

    Thanks.

    Nico


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •