I have a form inside floatbox, once submitted the data is being stored in a database. I then want floatbox to be closed and the user to be redirected to another page in a new window.
I have tried using <? header('Location: ... but it stays inside floatbox and then closes automatically in about 5 secs.
Any ideas?
Submit form then redirect outside of floatbox
Page: 1
Author | Post |
---|---|
s1mply
|
#1 Thu Jan 29, 2009 1:23 am
|
Guest | |
#2 Thu Jan 29, 2009 6:02 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
Your form is being submitted to a url defined by the form's "action" attribute. On submit, the returned html from that action url will be loaded by the browser in the window that performed the submit. In the case of a form within an iframe, the window in question is that iframe's window. So the returned content from your form submit will be processed by the iframe window that is being displayed inside floatbox.
If you want some behaviour other than simple display of the returned html, you would code this behaviour as javascript within the returned html. So, for example, if you want to close the floatbox and load a new page in the current browser instance, your returned page could include the following: parent.fb.loadPageOnClose = 'myNewPage.html'; parent.fb.end(); You mentioned a new window. Do you mean that you want a new browser popup window instance? If so, search on "window.open" for info on how to raise a new browser instance from your action page's javascript code. |
s1mply
|
#3 Tue Feb 24, 2009 12:13 am
|
Guest |
I have looked up window.open but I must be doing something wrong, see below:
<body onunload="window.open('http://website.com.au/documentpath')"> <script type="text/javascript"> parent.fb.end(); </script> </body> This is on the returned page. Basically, once someone has submitted the form, data is stored, then fb closes and a new window with option to download a document pops up. |
#4 Tue Feb 24, 2009 12:24 am
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
I suspect, but don't know, that body.unload doesn't fire when you destroy an iframe. (You're not really unloading it as you would be if you navigated away.)
Since window.open is a javascript call, why not move it into the javascript block? <script type="text/javascript"> window.open('http://website.com.au/documentpath'); parent.fb.end(); </script> </body> It's also quite likely that neither will work because of popup blockers. Popups will happen in response to a user action but will be blocked if they're called from code without a user action. If moving the window.open command as suggested doesn't work, you will have to try moving that call to maybe the onclick button of your form. Then the code is associated with a user action and should get past popup blockers. |
s1mply
|
#5 Tue Feb 24, 2009 12:48 am
|
Guest |
Great thanks!
|
Page: 1