- Posts: 30
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
To participate in this restricted survey, you need a valid token...
- rickanderson
- Topic Author
- Offline
- Junior Member
Less
More
5 years 4 months ago #177603
by rickanderson
To participate in this restricted survey, you need a valid token... was created by rickanderson
Hi...
I have added a javascript button on the end page of my survey which uses the 'html2pdf' script to print the results shown on the end page. This works fine in preview mode but on a live survey it refreshes to a page which states: "To participate in this restricted survey, you need a valid token".
Live survey participants are invited to the survey via a single token (with restricted number of uses and expiry date).
Can anyone suggest a way to avoid this? Ideally the end page would just remain on screen.
I am using LimeSurvey v3.15.5.
Cheers...Rick.
I have added a javascript button on the end page of my survey which uses the 'html2pdf' script to print the results shown on the end page. This works fine in preview mode but on a live survey it refreshes to a page which states: "To participate in this restricted survey, you need a valid token".
Live survey participants are invited to the survey via a single token (with restricted number of uses and expiry date).
Can anyone suggest a way to avoid this? Ideally the end page would just remain on screen.
I am using LimeSurvey v3.15.5.
Cheers...Rick.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
5 years 4 months ago #177605
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 To participate in this restricted survey, you need a valid token...
What is the code for your button?
To avoid submitting the #limesurvey form, it should have a type="button" attribute.
To avoid submitting the #limesurvey form, it should have a type="button" attribute.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: rickanderson
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 4 months ago #177612
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 To participate in this restricted survey, you need a valid token...
Else if you don't want use javascript : you can use
gitlab.com/SondagesPro/ExportAndStats/pdfReport
It can replace Print Survey default link to Download your report (where you do reportb with Expression)
It can replace Print Survey default link to Download your report (where you do reportb with Expression)
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 following user(s) said Thank You: rickanderson
The topic has been locked.
- rickanderson
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 3
5 years 4 months ago #177645
by rickanderson
Replied by rickanderson on topic To participate in this restricted survey, you need a valid token...
Thanks Tony...
The code for the button is:
and the javacsript:
I'll try with type="button" to see if that helps.
Cheers
...Rick
The code for the button is:
Code:
<button id="btn">SAVE YOUR REPORT</button>
and the javacsript:
Code:
<script> var element = document.getElementById('finalScores'); var opt = { margin: 5, filename: 'drive.pdf', image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'mm', format: 'a4', orientation: 'landscape' } }; var btn = document.getElementById("btn"); btn.addEventListener('click',function(){ html2pdf().set(opt).from(element).save(); }); </script>
I'll try with type="button" to see if that helps.
Cheers
...Rick
The topic has been locked.
- rickanderson
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 3
5 years 4 months ago #177646
by rickanderson
Replied by rickanderson on topic To participate in this restricted survey, you need a valid token...
Thanks Denis...
I'll have a look at pdfReport if I am unable to sort out the current javascript method.
Cheers
...Rick.
I'll have a look at pdfReport if I am unable to sort out the current javascript method.
Cheers
...Rick.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
5 years 4 months ago - 5 years 4 months ago #177647
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 To participate in this restricted survey, you need a valid token...
Try this:
Code:
<button type="button" id="btn">SAVE YOUR REPORT</button>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 4 months ago by tpartner.
The following user(s) said Thank You: rickanderson
The topic has been locked.
- rickanderson
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 3
5 years 4 months ago #177652
by rickanderson
Replied by rickanderson on topic To participate in this restricted survey, you need a valid token...
That seems to have done the job...thanks again Tony.
Thanks both Tony and Denis for your responses, much appreciated .
Cheers
...Rick.
Thanks both Tony and Denis for your responses, much appreciated .
Cheers
...Rick.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13643
- Thank you received: 2491
5 years 4 months ago #177653
by DenisChenu
gitlab.com/SondagesPro/ExportAndStats/pdfReport#documentation
PDF is done in PHP and saved as 'file upload' in your survey. This file upload question type can be hidden, and you can replace default way to 'Print your survey' to directly download the generated PDF.
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 To participate in this restricted survey, you need a valid token...
No javascript methos .rickanderson wrote: I'll have a look at pdfReport if I am unable to sort out the current javascript method.
gitlab.com/SondagesPro/ExportAndStats/pdfReport#documentation
PDF is done in PHP and saved as 'file upload' in your survey. This file upload question type can be hidden, and you can replace default way to 'Print your survey' to directly download the generated PDF.
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 following user(s) said Thank You: rickanderson
The topic has been locked.
- rickanderson
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 3
5 years 4 months ago #177658
by rickanderson
Replied by rickanderson on topic To participate in this restricted survey, you need a valid token...
Thanks Denis...will probably look into this method for next version of our survey.
Cheers
...Rick.
Cheers
...Rick.
The topic has been locked.