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
Solved

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

Posted on 2009-05-20
8
8,993 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
how can i get the sole odd and th sole even 2 33
Asp in script 6 37
forgetful about js objects 8 46
JQuery Syntax... 4 33
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

861 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