Welcome Guest, Not a member yet? Register   Sign In
closing popup and refreshing popup parent window after form submit
#1

[eluser]crwtrue[/eluser]
What would a be codeigniter way to do this? Cause there is a function for popup(anchor_popup()) and with this javascript you can do this
Code:
window.close();
window.opener.location.reload();

but i dont want to put that code in the controller so what would be the standard way to do this?
#2

[eluser]slowgary[/eluser]
That's JavaScript, so there's no 'CodeIgniter' way, since CodeIgniter is a PHP framework. The anchor_popup() function, while I'm not familiar with it, probably justs adds "target='_blank'" to the link so that it forces a new window.

I wouldn't recommend putting any sort of JavaScript in your controller, do it in your view. There's not really a "standard" way to do that other than the way you are doing it.

I assume you want to close a window and refresh the window that opened that window. First, you should know that you can only use JavaScript to close windows that were opened with JavaScript. So if you're opening a popup from a main window, this will work. Then in your popup, you'd probably want to do those things in response to an event, so you'd add something like this to your popup window:
Code:
<a >close this window</a>

You'll need to do the reload FIRST, otherwise the window will already be closed and the reload will probably not get executed.
#3

[eluser]John_Betong[/eluser]
[quote author="crwtrue" date="1248140611"]What would a be codeigniter way to do this? Cause there is a function for popup(anchor_popup()) and with this javascript you can do this
Code:
window.close();
window.opener.location.reload();

but i dont want to put that code in the controller so what would be the standard way to do this?[/quote]
&nbsp;
My kludge is to include the following code snippet in my popup_view file:
Code:
&lt;form action='#'&gt;
    <p>
      &lt;input  id='close'  type='button' value="Close Window" /&gt;
       &nbsp;&nbsp;
      <br /><br />
    </p>    
  &lt;/form&gt;
&nbsp;
&nbsp;
&nbsp;
77




Theme © iAndrew 2016 - Forum software by © MyBB