- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Limesurvey in Iframe - hide iframe after survey is submited
- LurLur
- Topic Author
- Offline
- New Member
Less
More
3 months 2 weeks ago #254277
by LurLur
Limesurvey in Iframe - hide iframe after survey is submited was created by LurLur
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 6.3.6+231120
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity_twentythree
==================
Hi everyone,
I am sure this is possible but I just don't know where to add the code for it.
I run limesurvey on my own website and want to show the survey in an iframe (which works).
However, I also want to hide this iframe once the user submitted the survey. Where can i change some file in lime survey to do that?
I guess it has to do with the moveSubmit button but I can't find where the submit is handled.
Best
LurLur
Your LimeSurvey version: LimeSurvey Community Edition Version 6.3.6+231120
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity_twentythree
==================
Hi everyone,
I am sure this is possible but I just don't know where to add the code for it.
I run limesurvey on my own website and want to show the survey in an iframe (which works).
However, I also want to hide this iframe once the user submitted the survey. Where can i change some file in lime survey to do that?
I guess it has to do with the moveSubmit button but I can't find where the submit is handled.
Best
LurLur
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 months 2 weeks ago #254299
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Limesurvey in Iframe - hide iframe after survey is submited
This is not a Limesurvey issue, but rather a HTML issue or an issue of your website. Limesurvey just shows up in your iframe, that's it. To close / hide the iframe, you need to do through your website, e.g. set a cookie and based on the cookie you show/hide the iframe with the survey. You won't find a setting for this in Limesurvey, because there is no setting in limesurvey and there can't be a setting in Limesurvey. The site shown in an iframe has no control over the iframe. This would be a serious security issue. Imagine a website that is shown within an iframe could manipulate your website.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- LurLur
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
3 months 2 weeks ago - 3 months 2 weeks ago #254300
by LurLur
Replied by LurLur on topic Limesurvey in Iframe - hide iframe after survey is submited
Thx for the quick reply,
however I think you misinterpreted my question (maybe I am in the wrong sub forum?):
I am not searching for a setting in limesurvey. I want to find the code/file where the action of the submit button is defined so I can adjust this code to also close the iframe. Both pages are hosted by me, it is not a kind of crosssite scripting.
(see stackoverflow.com/questions/14645647/sub...nd-show-a-hidden-div for something similar for what I want to achieve)
however I think you misinterpreted my question (maybe I am in the wrong sub forum?):
I am not searching for a setting in limesurvey. I want to find the code/file where the action of the submit button is defined so I can adjust this code to also close the iframe. Both pages are hosted by me, it is not a kind of crosssite scripting.
(see stackoverflow.com/questions/14645647/sub...nd-show-a-hidden-div for something similar for what I want to achieve)
Last edit: 3 months 2 weeks ago by LurLur.
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 months 2 weeks ago #254303
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Limesurvey in Iframe - hide iframe after survey is submited
You are right, I missinterpreted your question.
However, while not a Javascript expert, I am not sure if you will be able to manipulate your website (where the iframe is) from within the iframe, e.g. when clicking on the submit button close the iframe. I still think this would be a security issue.
Let's see if Tpartner shows up, he is surely the expert for those things that involve Javascript for example.
However, while not a Javascript expert, I am not sure if you will be able to manipulate your website (where the iframe is) from within the iframe, e.g. when clicking on the submit button close the iframe. I still think this would be a security issue.
Let's see if Tpartner shows up, he is surely the expert for those things that involve Javascript for example.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
3 months 2 weeks ago - 3 months 2 weeks ago #254316
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Limesurvey in Iframe - hide iframe after survey is submited
Since there should be no cross-domain issues, try this in the source of a question in the last survey group. (but test that the survey actually submits)
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ $('#limesurvey').on('submit', function(e) { top.document.getElementById("myiframe").style.display="none"; }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 months 2 weeks ago by tpartner.
The following user(s) said Thank You: DenisChenu, holch
Please Log in to join the conversation.
- LurLur
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
3 months 2 weeks ago #254318
by LurLur
Replied by LurLur on topic Limesurvey in Iframe - hide iframe after survey is submited
Thanks,
this worked with a little tweak instead of hiding it, it set height and width to 0.
Thx a lot!
this worked with a little tweak instead of hiding it, it set height and width to 0.
Thx a lot!
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11660
- Thank you received: 2742
3 months 2 weeks ago #254321
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Limesurvey in Iframe - hide iframe after survey is submited
Tpartner to the rescue again!
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- LurLur
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
3 months 4 days ago - 3 months 4 days ago #254899
by LurLur
Replied by LurLur on topic Limesurvey in Iframe - hide iframe after survey is submited
A quick follow-up question: Is there a possibility to adjust the code slightly, because right now the iframe will be closed, even if some mandatory question is not answered when pressing submit.
Last edit: 3 months 4 days ago by LurLur.
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
3 months 4 days ago - 3 months 4 days ago #254906
by DenisChenu
But in general what i do i create a jquery function in parent : something like
and inside iframe
See : gitlab.com/SondagesPro/QuestionSettingsT...ssets/extraSurvey.js
and gitlab.com/SondagesPro/QuestionSettingsT...nExtraSurvey.js#L169
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Limesurvey in Iframe - hide iframe after survey is submited
since we need it only after submit : why not, in end text contentSince there should be no cross-domain issues, try this in the source of a question in the last survey group. (but test that the survey actually submits)
Code:
<script> top.document.getElementById("myiframe").style.display="none"; </script>
But in general what i do i create a jquery function in parent : something like
Code:
$(document).on('survey:submitted', function() { // hide, remove, replace iframe });
Code:
window.parent.$(window.parent.document).trigger('survey:submitted');
See : gitlab.com/SondagesPro/QuestionSettingsT...ssets/extraSurvey.js
and gitlab.com/SondagesPro/QuestionSettingsT...nExtraSurvey.js#L169
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 3 months 4 days ago by DenisChenu.
Please Log in to join the conversation.