- Posts: 35
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Printing answers throughout the survey
- BusyBonsai
- Topic Author
- Offline
- Junior Member
Less
More
4 years 8 months ago #187981
by BusyBonsai
Printing answers throughout the survey was created by BusyBonsai
Dear Limes,
I am using LS 3.8.0+180522, installed on our institutional servers.
So in the “Presentation” part of general settings, you can switch on and off “Participants may print answers”. When switched on, at the end of survey (after submitting) a text “print answers” is displayed and hyperlinked with/as something like ourLSdomain.eu/index.php/printanswers/view?surveyid=845228 . Screenshot of where that Button/Link leads to looks like is attached.
Our aim: presenting that Button on every page (not just the pager after pressing submit), so respondents can print their answers on any point throughout the survey.
As a service unit, we are beyond the point of questioning that need. We are also aware of possible workarounds, e.g. that build forms with that display the variables used in the survey to print out etc.
[We are also aware that printing answers pulls those from the server, and that answers are saved on the server first when the according page was submitted (by clicking “next” or “submit”).]
Status quo: We copied the following code, which we found in theme editor, “completed” screen, “submit.twig”:
{# Link to Print Answer Preview #}
{% if (aSurveyInfo.aCompleted.aPrintAnswers.show == true) %}
<!-- Link to Print Answer Preview -->
<div class="{{ aSurveyInfo.class.submitwrapperdiva }}" {{ aSurveyInfo.attr.submitwrapperdiv }}>
<a href="{{ aSurveyInfo.aCompleted.aPrintAnswers.sUrl }}" class="{{ aSurveyInfo.class.submitwrapperdivaa }}" {{ aSurveyInfo.attr.submitwrapperdivaa }}>
{{ gT("Print your answers.") }}
</a>
</div>
{% endif %}
And pasted it at the end of “main.twig” in the “question” screen while replacing “true” with “false”. The text/link shows up, however upon clicking it seems to loop back to the same page, pretty much like I’d press F5. So I guess “aSurveyInfo.aCompleted.aPrintAnswers.sUrl”(the href tag content) does only successfully translate to “https://ourLSdomain.eu/index.php/printanswers/view?surveyid=845228” after the survey (answers) was(were) actually submitted. Deleting the “.aCompleted”-part didn’t help. In the copied and pasted code we then replaced “aSurveyInfo.aCompleted.aPrintAnswers.sUrl”(the href tag content) - being a variable - with “https://ourLSdomain.eu/index.php/printanswers/view?surveyid=845228” – the value this variable would have for this survey. But since this feature might be useful for other surveys to come in the future we want to have the clean variable-based solution, not the quick and dirty value-based one.
Can any of you help us from here? I hope I could explain everything clear enough.
I am using LS 3.8.0+180522, installed on our institutional servers.
So in the “Presentation” part of general settings, you can switch on and off “Participants may print answers”. When switched on, at the end of survey (after submitting) a text “print answers” is displayed and hyperlinked with/as something like ourLSdomain.eu/index.php/printanswers/view?surveyid=845228 . Screenshot of where that Button/Link leads to looks like is attached.
Our aim: presenting that Button on every page (not just the pager after pressing submit), so respondents can print their answers on any point throughout the survey.
As a service unit, we are beyond the point of questioning that need. We are also aware of possible workarounds, e.g. that build forms with that display the variables used in the survey to print out etc.
[We are also aware that printing answers pulls those from the server, and that answers are saved on the server first when the according page was submitted (by clicking “next” or “submit”).]
Status quo: We copied the following code, which we found in theme editor, “completed” screen, “submit.twig”:
{# Link to Print Answer Preview #}
{% if (aSurveyInfo.aCompleted.aPrintAnswers.show == true) %}
<!-- Link to Print Answer Preview -->
<div class="{{ aSurveyInfo.class.submitwrapperdiva }}" {{ aSurveyInfo.attr.submitwrapperdiv }}>
<a href="{{ aSurveyInfo.aCompleted.aPrintAnswers.sUrl }}" class="{{ aSurveyInfo.class.submitwrapperdivaa }}" {{ aSurveyInfo.attr.submitwrapperdivaa }}>
{{ gT("Print your answers.") }}
</a>
</div>
{% endif %}
And pasted it at the end of “main.twig” in the “question” screen while replacing “true” with “false”. The text/link shows up, however upon clicking it seems to loop back to the same page, pretty much like I’d press F5. So I guess “aSurveyInfo.aCompleted.aPrintAnswers.sUrl”(the href tag content) does only successfully translate to “https://ourLSdomain.eu/index.php/printanswers/view?surveyid=845228” after the survey (answers) was(were) actually submitted. Deleting the “.aCompleted”-part didn’t help. In the copied and pasted code we then replaced “aSurveyInfo.aCompleted.aPrintAnswers.sUrl”(the href tag content) - being a variable - with “https://ourLSdomain.eu/index.php/printanswers/view?surveyid=845228” – the value this variable would have for this survey. But since this feature might be useful for other surveys to come in the future we want to have the clean variable-based solution, not the quick and dirty value-based one.
Can any of you help us from here? I hope I could explain everything clear enough.
Attachments:
The topic has been locked.
- BusyBonsai
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 35
- Thank you received: 0
4 years 8 months ago #187982
by BusyBonsai
Replied by BusyBonsai on topic Printing answers throughout the survey
In case you are wondering (since I didn't mention it) - the screen "print answers" in the template editor is a blackbox to me yet.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
4 years 8 months ago - 4 years 8 months ago #188004
by DenisChenu
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 Printing answers throughout the survey
I use it in some Survey,
But i set directly it in Group description
Not clean, but work.
But i set directly it in Group description
Code:
<a href="/index.php/printanswers/view?surveyid={SID}" target="_black">View you complete survey</a>
Not clean, but work.
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: 4 years 8 months ago by DenisChenu.
The topic has been locked.
- BusyBonsai
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 35
- Thank you received: 0
4 years 7 months ago #188050
by BusyBonsai
Replied by BusyBonsai on topic Printing answers throughout the survey
Dear Denis Chenu
Okay, that'll do. A bit embarassing that I didn't come up with this myself. Thank you really much!
Best
Adam
Okay, that'll do. A bit embarassing that I didn't come up with this myself. Thank you really much!
Best
Adam
The topic has been locked.
- MSouad
- Offline
- Administrator
Less
More
- Posts: 3
- Thank you received: 0
1 year 6 months ago - 1 year 6 months ago #232364
by MSouad
Replied by MSouad on topic Printing answers throughout the survey
Hello,
I tried to use this script in the last group of my survey in order to add a print button before the end of the questionnaire, but I was unable to make it work.
I am attaching the screenshots of what I did and what I got
Can anyone advise please?
I tried to use this script in the last group of my survey in order to add a print button before the end of the questionnaire, but I was unable to make it work.
I am attaching the screenshots of what I did and what I got
Can anyone advise please?
Attachments:
Last edit: 1 year 6 months ago by MSouad.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
1 year 6 months ago #232368
by DenisChenu
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 Printing answers throughout the survey
1. What is the url of your admin page ?
2. Can you activate debug mode ? manual.limesurvey.org/Debug_mode
2. Can you activate debug mode ? manual.limesurvey.org/Debug_mode
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.
The topic has been locked.
- MSouad
- Offline
- Administrator
Less
More
- Posts: 3
- Thank you received: 0
1 year 6 months ago #232389
by MSouad
Replied by MSouad on topic Printing answers throughout the survey
Thanks for your reply Denis
The URL of my admin page is: itstartswithdata.limesurvey.net/index.php/admin
I am sorry I didn't succeed to activate the debugging mode, instructions on the manual aren't clear. Do I just have to copy that code somewhere?
The URL of my admin page is: itstartswithdata.limesurvey.net/index.php/admin
I am sorry I didn't succeed to activate the debugging mode, instructions on the manual aren't clear. Do I just have to copy that code somewhere?
The topic has been locked.