Solved

Greybox Javascript - need function to close greybox window and reload window that spawned it?

Posted on 2009-05-20
8
9,058 Views
Last Modified: 2012-05-07
I'm using Greybox on a site I'm developing (ie: http://orangoo.com/labs/GreyBox/) and I need be able to both close the greybox window -- AND -- reload the page underneath it.  How would I go about that?

I have the following, .. but it doesn't seem to be working correctly in IE7.

function closeGreybox() {
    parent.parent.GB_hide();
    parent.parent.reload();
}

Please advise.  Thanks!

- Yvan
0
Comment
Question by:egoselfaxis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Expert Comment

by:tyconz_helpdesk2008
ID: 24437014
Hi Yvan,

For closing the Greybox window use:

$("#GB_window,#GB_overlay").hide();

0
 
LVL 1

Expert Comment

by:tyconz_helpdesk2008
ID: 24437063
Yvan, maybe this will point you in the right direction for reloading...

<form name="form2" method="post" action="/%path%//%program%/" onSubmit="javascript:window.top.location.reload();">  

You can find it from here:
http://www.code400.com/forum/showthread.php?p=23735
0
 
LVL 1

Accepted Solution

by:
tyconz_helpdesk2008 earned 500 total points
ID: 24437656
I tried the following on IE8 and it worked for me:

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:egoselfaxis
ID: 24441084
Thanks!
- yg
0
 

Expert Comment

by:RandomPixel
ID: 25581397
Can someone tell me exactly how to implement this code please.
Where does this go and how exactly should it be included in my code and how does it get called from GreyBox

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}

Many thanks,
Houston
0
 

Expert Comment

by:RandomPixel
ID: 25647916
function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}

Where does this code go and how do you call it or what calls it? I am not a javascript person So I need a little hand holding if you please.

Thanks,
Houston
0
 

Expert Comment

by:RandomPixel
ID: 25648049
I have this in my form code:
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="closeGreybox();">

and I have this in the head tag:
<script type="text/javascript">

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
</script>

It works sometimes but not always. I know that sounds strange but that is the case.

I can not provide  a link as the site is now live and I am trying to get this to work.
0
 

Expert Comment

by:RandomPixel
ID: 25648186
Here the code for a page that it does not work on:

<?
session_start();
 require_once("../class/sqlQuery.class.php");

if ($_SESSION['admin']<1)
{
header("Location: index.php");
exit();
};





if ($_POST["edit"]=="Edit") {

$qry->queryExecute("UPDATE `category` SET  name='". mysql_real_escape_string($_POST["name"])."' WHERE id = $_GET[id] ");
$complete = 1;
};
$data=$qry->querySelectSingle("SELECT * FROM `category` WHERE id='$_GET[id]'");


?>
<head>
<script type="text/javascript">

function closeGreybox() {
    parent.parent.GB_hide();
    window.top.location.reload();
}
</script>
</head>
<link type="text/css" rel="stylesheet" href="dhtmlgoodies_calendar/dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
      <SCRIPT type="text/javascript" src="dhtmlgoodies_calendar/dhtmlgoodies_calendar.js?random=20060118"></script>

<form id="form1" name="form1" method="post" action="" onSubmit="closeGreybox();">
<table>
  <tr>
    <td >Name of Category</td>
    <td >
      <label>
        <input name="name" type="text" id="name" value="<?= $data['name'];?>" />
        </label>    </td>
  </tr>
  <? if ($data['type'] == 3) { ?><? }; ?>
 <? if ($data['type'] == 2) { ?><? }; ?>
  <? if ($data['type'] == 1 or $data['type'] == 2) { ?> <? }; ?>
 
  <tr>
    <td  colspan="2">
      <div align="center">
        <label>
       
        <input type="submit" name="edit" id="edit" value="Edit" />      
        </label>
      </div></td>
    </tr>
  <tr>
    <td  colspan="2"><? if($complete == 1) echo '<div align="center">Updated!</div>';?></td>
  </tr>
</table>
</form>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question