Question

I am trying to implement something like this:

  1. Clicking on a link, a pop-up will be opened, something like sign-up page.

  2. On submission, if data is unfilled, an error message will be generated.

But on successful submission, it will be redirected to the main page opened earlier in the browser.

Im using thickbox for the pop-up feature. On redirecting using the following code:

<meta http-equiv="refresh" content="1;url=http://localhost/cgi-bin/Ajax/index.pl/">

The main page is being redirected, but in the pop-up itself I want the pop-up to die after successful submission and the main page gets refreshed.

Was it helpful?

Solution

I'll asume you're using the iFrame solution from the thickbox website. It looks to me that you have to set the modal=true part in the URL and use the tb_remove() function once the login is completed. The same goes for the AJAX version.

Optionally you may add modal=true to the query string (e.g. ?KeepThis=true&TB_iframe=true&height=400&width=600&modal=true) so that closing a ThickBox will require calling the tb_remove() function from within the ThickBox iframe (self.parent.tb_remove()). See the iframe demo for an example, where you must click "ok" to close the ThickBox.

You should therefore just add something like this to your javascript (that you print from perl iirc).

<script type="text/javascript">
tb_remove();
</script>
<meta http-equiv="refresh" content="1;
      url=http://localhost/cgi-bin/Ajax/index.pl/">

Please note that I have not tested this and I'm only referring to the documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top