Solved

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

Posted on 2009-05-20
8
9,035 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

737 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