This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 3
Open redirect URL in same iFrame
Started 12 years ago by inkpotprinting | 5 posts |
-
Our form is in an iFrame and I would like the redirect URL to open in the iFrame and not the whole browser window. The instructions I found by searching the forum relate to the previous version, and we're using the latest one. Adding target="_self" to the end of the redirect URL didn't work. Can you help?
Posted 12 years ago # -
You need to edit your "embed.php" file, search around line 70 for this code:
echo "<script type=\"text/javascript\">top.location = '{$submit_result['form_redirect']}'</script>";
change it to become:
echo "<script type=\"text/javascript\">self.location = '{$submit_result['form_redirect']}'</script>";
MachForm Founder
Posted 12 years ago # -
Thank you for your reply Yuniar. I have 5 different forms on this website and am only using one of them in an iFrame, will editing this file change the behaviour of all of the forms?
Posted 12 years ago # -
Ah..yes, this would affect all of your form. However, there is a simple modification to only apply this code to a particular form.
So let say you have a form with this URL:
http://www.example.com/machform/view.php?id=1200that means your form is having id number 1200.
You need to modify your embed.php file, around line 70 as above, to be like this instead:
if($input_array['form_id'] == 1200){ echo "<script type=\"text/javascript\">self.location = '{$submit_result['form_redirect']}'</script>"; }else{ echo "<script type=\"text/javascript\">top.location = '{$submit_result['form_redirect']}'</script>"; }
that would limit the modification to one particular form. Change the above id number with your own form id number.
MachForm Founder
Posted 12 years ago # -
Hi Yuniar
I tried this and the redirect opens in the div the form code is in, and not the whole iFrame which is the desired behaviour. I tried changing self to parent in the code you suggested and that did what I wanted.
Can you please consider having this behaviour as selectable from the GUI?
Posted 12 years ago #
Reply
You must log in to post.