Advanced Forms Addon
Permalink 2 users found helpful
Hi Together,
I already posted this issue in the advanced forms addon forum but haven`t received a satisfying answer yet.
I am using the "redirect to a specific URL after submit" feature of the addon. Redirection works fine and by default opens in the same window. I would like to have the redirect opened in a new window. According to the developer it`s possible, but modifications are neccessary.
Does anyone else using this addon know an answer or had the same "problem"? As I am a complete noob with Javascript and .php, I would highly appreciate, if someone could help me.
Thank you and regards,
Kat
I already posted this issue in the advanced forms addon forum but haven`t received a satisfying answer yet.
I am using the "redirect to a specific URL after submit" feature of the addon. Redirection works fine and by default opens in the same window. I would like to have the redirect opened in a new window. According to the developer it`s possible, but modifications are neccessary.
Does anyone else using this addon know an answer or had the same "problem"? As I am a complete noob with Javascript and .php, I would highly appreciate, if someone could help me.
Thank you and regards,
Kat
Thank you very much for your awesome reply. Worked out well!
Only thing that "bothers" me now is, that the popup gets blocked (depending on browser settings). Is it possible to do the same thing
with a "=target_blank" instruction or something else to avoid the blocking?
Only thing that "bothers" me now is, that the popup gets blocked (depending on browser settings). Is it possible to do the same thing
with a "=target_blank" instruction or something else to avoid the blocking?
This might fix that problem.
case 'redirect': $redirectlocation = response.response; window.open($redirectlocation,'','_blank'); break;
Thanks again.
Unfortunately this didn`t work. As far as I understand it, the window.open function will always open a popup that might get blocked.
Is it possible to keep the window.location function and put the "target=_blank" into the form tag to open a new window/tab?
Unfortunately this didn`t work. As far as I understand it, the window.open function will always open a popup that might get blocked.
Is it possible to keep the window.location function and put the "target=_blank" into the form tag to open a new window/tab?
I think something like this will work:
I'm not sure whether it will work or not but have it a try.
Rony
case 'redirect': $redirectlocation = response.response; echo '<a id="redirect_link" href="'.$redirectlocation.'" target="_blank" style="display: none">Location</a> <script type="text/javascript"> $(document).ready(function(){ $("#redirect_link").click(); }); </script>'; break;
I'm not sure whether it will work or not but have it a try.
Rony
Many thanks for your reply, Rony!
I gave it a try but it didn`t work. Redirection occurs in the same window.
I am not quite sure, but there seems to be something wrong with the syntax. There is no error message from the system, but parts of the source code following the </script> tag were displayed on the site right above the form.
I gave it a try but it didn`t work. Redirection occurs in the same window.
I am not quite sure, but there seems to be something wrong with the syntax. There is no error message from the system, but parts of the source code following the </script> tag were displayed on the site right above the form.
So I think I managed to get this or at least part of the way.
For your form settings, Choose Display a message. Then in the message box put
of course changing the url to whatever.
Then in the root/packages/sixeightforms/blocks/sixeightforms/templates/view.php
modify the case for thank you (line 292) to this.
For your form settings, Choose Display a message. Then in the message box put
<a href="http://www.cnn.com" target="_blank" id="redirected_link" > </a>
of course changing the url to whatever.
Then in the root/packages/sixeightforms/blocks/sixeightforms/templates/view.php
modify the case for thank you (line 292) to this.
case 'thankyou': $('#sem-form-<?php echo $bID; ?>').fadeOut('fast',function() { <?php if($displayInDialog != 1) { ?> $('#sem-form-response-<?php echo $bID; ?>').html(response.response); $(document).ready(function() { if ($('#redirected_link').length >0) { $("#redirected_link")[0].click(); } else { } }); <?php } ?>
Viewing 15 lines of 21 lines. View entire code block.
Scratch my previous post at it has the same problem with the pop-up as before.
Perhaps we should try a more direct approach.
Like modifying the form .
Try changing line 475 of root/packages/sixeightforms/blocks/sixeightforms/templates/view.php to
This way it will not matter what you select in the form settings.
Perhaps we should try a more direct approach.
Like modifying the form .
Try changing line 475 of root/packages/sixeightforms/blocks/sixeightforms/templates/view.php to
This way it will not matter what you select in the form settings.
The last one nailed it. Thank you very much!
I tried the other solution as well, but it got blocked (just as you mentioned).
So, if I have like 20 or 30 forms I want to redirect, I will have to create a specific template view.php for each of them?
I tried the other solution as well, but it got blocked (just as you mentioned).
So, if I have like 20 or 30 forms I want to redirect, I will have to create a specific template view.php for each of them?
Wohoo! I think so. Assuming they are going to different urls. If they are going to the same url, then you could use the same template.
Oh and make sure to select the best answer so that others can find it.
I sure will:-)
Once again, thanks for the great help!
Once again, thanks for the great help!
Hi again,
while the thing itself works perfectly fine, I recently found out, that through the redirection any required data of the form gets ignored. You can press the submit button without filling out anything and the redirection takes place. This is messing up my statistics....
Does anyone have a suggstion how to fix this?
while the thing itself works perfectly fine, I recently found out, that through the redirection any required data of the form gets ignored. You can press the submit button without filling out anything and the redirection takes place. This is messing up my statistics....
Does anyone have a suggstion how to fix this?
I think you have run into a basic limitation of web servers. When you redirect to another url, any get or post data attached to the original request doesn't automatically get passed through to the redirected request.
I have been having a problem with trying to log debug data in a function that does a re-direct at the end, and stumbled upon this while researching that. Does this comment imply (as I believe it might) that by doing a redirect, I lose the log statements from the header?
Here's my boiled down to the minimum problem function. With the redirect commented out, I get logs. With it enabled, no logs, and it does the redirect as asked.
Thanks John - you've helped me dozens & dozens of times with posts you've made in the past :)
Here's my boiled down to the minimum problem function. With the redirect commented out, I get logs. With it enabled, no logs, and it does the redirect as asked.
Thanks John - you've helped me dozens & dozens of times with posts you've made in the past :)
Yes, that is exactly the limitation you have run into.
If all you are looking for is some diagnostics while developing, you can add direct to the c5 log.
See
http://www.concrete5.org/documentation/how-tos/developers/concrete5...
You can then view the log in the dashboard.
For convenience, you can also add a log viewing block to a page and it will then retrieve and show the latest log entries, no matter how many redirects happen in between.
http://www.concrete5.org/marketplace/addons/quick-log-view/...
If all you are looking for is some diagnostics while developing, you can add direct to the c5 log.
See
http://www.concrete5.org/documentation/how-tos/developers/concrete5...
You can then view the log in the dashboard.
For convenience, you can also add a log viewing block to a page and it will then retrieve and show the latest log entries, no matter how many redirects happen in between.
http://www.concrete5.org/marketplace/addons/quick-log-view/...
So if the settings of your form is set to redirect to another page on the site, you could do the following:
create a folder called templates in the root/packages/sixeightforms/blocks/sixeightforms folder.
copy the root/packages/sixeightforms/blocks/sixeightforms/view.php file to the root/packages/sixeightforms/blocks/sixeightforms/templates folder
rename the root/packages/sixeightforms/blocks/sixeightforms/templates/view.php file to let's call it new_window.php
replace lines 303-306 from this
to this:
then after you have added your form to the page, click on it, select custom template, choose, New Window.