Printing answers throughout the survey

More
1 year 4 months ago #187981 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.
Attachments:
The topic has been locked.
LimeSurvey Partners
More
1 year 4 months ago #187982 by BusyBonsai
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.
More
1 year 4 months ago - 1 year 4 months ago #188004 by DenisChenu
I use it in some Survey,

But i set directly it in Group description
<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: 1 year 4 months ago by DenisChenu.
The topic has been locked.
More
1 year 4 months ago #188050 by BusyBonsai
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
The topic has been locked.

Start now!

Just create your account and start using Limesurvey today.

Register now