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 10 of 10
  1. #1
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts

    Close Window not working

    I have a basic insert form to add items to a product database. It opens as a pop-up window from a different form so that my sales reps can add items to the database if they are not there without having to back track. I want to have a close window option for when they are done.

    here is what I have so far:
    Code:
    <body>
    <div id="wrapper">
      <div id="titlebar"><img src="images/header.jpg" alt="Graphic Edge Printing" /></div>
      <div id="maincontent">
        <div id="nav">
          <?php include('navbar.php'); ?>
        </div>
        <h1 align="center">Sheet Size Insert </h1>
        <p align="center">Check the list below, if the sheet size you would like to use is not listed, please add it. </p>
        <form action="<?php echo $editFormAction; ?>" id="Press" name="Press" method="POST">
          <table width="457" border="0" cellspacing="0" cellpadding="2" align="center">
            <tr>
              <td width="128"><div align="right">Sheet Size  : </div></td>
              <td width="189"><input type="text" name="SheetDesc" /></td>
              <td width="128"><center><input name="Add Size" type="submit" id="Add Size" value="Add Size" />
              </center></td>
            </tr>
          </table>
          
          <input type="hidden" name="MM_insert" value="Press">
    </form>
        <p align="center">&nbsp;</p>
        <table width="200" border="1" cellspacing="0" cellpadding="2" align="center">
          <tr>
            <th scope="col">Sheet Size  Options </th>
          </tr>
          <?php do { ?>
            <tr>
              <td><div align="center"><?php echo $row_SheetSize['SheetDesc']; ?></div></td>
            </tr>
            <?php } while ($row_SheetSize = mysql_fetch_assoc($SheetSize)); ?>
        </table>
        <p>
          <input name="button" type="button" onclick="window.close()" value="Close Window" />
        </p>
      </div>
      <div id="footer"><?php include('copyright.php'); ?></div>
    </div>
    </body>
    but the close window button doesn't work. any ideas?

  • #2
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    The browser can forbid the scripts to close windows. If you are using FF, check whether the option dom.allow_scripts_to_close_windows is set to true.
    I am still learning English

  • #3
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts
    Safari ATM actually.
    I can check that, what if it fails though? Do have any other options?
    I'll try again to find, the thing that was my mind...
    The only other sign, it says I've lost my mind.

  • #4
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    Will you please post a link to your page where I can test it myself?
    I am still learning English

  • #5
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts
    http://graphicedgeprinting.com/test.php

    I removed the database access for security reasons.
    I'll try again to find, the thing that was my mind...
    The only other sign, it says I've lost my mind.

  • #6
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts
    well flip!
    now it works! but after I submit a record, it doesn't.
    is there any reason running the insert record function then reloading the page would make the close window button not work?
    I'll try again to find, the thing that was my mind...
    The only other sign, it says I've lost my mind.

  • #7
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    Most probably, when you are reloading the entire page, the popup window loses its association with an opener window and becomes an individual window, which does not treat the close() method.
    Last edited by Amphiluke; 07-16-2009 at 07:41 PM. Reason: grammar mistake
    I am still learning English

  • #8
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts
    That makes sense.
    is there a way around that?
    I'll try again to find, the thing that was my mind...
    The only other sign, it says I've lost my mind.

  • #9
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    ... maybe if you'll create the popup window with an iframe inside it, and you'll load the page with the form (http://graphicedgeprinting.com/test.php) into the iframe, while the 'close' button will be outside the iframe?

    In the popup window (say, popup.htm)
    Code:
    <p><iframe id="ifrm" src="http://graphicedgeprinting.com/test.php" width="750" height="450"></iframe></p>
    
    <!-- the button is outside the iframe -->
    <p><input name="button" type="button" onclick="window.close()" value="Close Window" /></p>
    In the opener window
    Code:
    <p><input name="button" type="button" onclick="window.open('popup.htm', '', '');" value="Open Window" /></p>
    If the document is reloaded inside the iframe, it does not affect the popup window itself, so, the popup window can be closed with the "Close Window" button. Such a workaround... If it doesn't suit you, sorry, I do not see any other way.
    Last edited by Amphiluke; 07-16-2009 at 08:34 PM. Reason: little grammar revision
    I am still learning English

  • Users who have thanked Amphiluke for this post:

    Alith7 (07-16-2009)

  • #10
    Regular Coder
    Join Date
    Jun 2009
    Posts
    121
    Thanks
    22
    Thanked 3 Times in 3 Posts
    You are right, it is not ideal, but it will work for now until I can figure out a better way to do this.

    Thank you!
    I'll try again to find, the thing that was my mind...
    The only other sign, it says I've lost my mind.


  •  

    Posting Permissions

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