- Posts: 19
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Access QID in twig file?
- AuPath
- Topic Author
- Offline
- New Member
Less
More
4 years 6 days ago - 4 years 6 days ago #197449
by AuPath
Access QID in twig file? was created by AuPath
Is it possible to have access to the qid for the current question in the theme's question.twig file?
I tried
but it does not seem to work.
I tried
Code:
'{{ processString('{QID}') }}'
Last edit: 4 years 6 days ago by AuPath.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 6 days ago #197475
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 Access QID in twig file?
No, because there may be several questions on a screen.
What are you trying to do?
What are you trying to do?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- AuPath
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
4 years 6 days ago #197476
by AuPath
Replied by AuPath on topic Access QID in twig file?
I have a script in a custom Theme that tracks the user's mouse movement while he is answering a question.
Each question is displayed as a separate page.
I then store all this data in the Limesurvey database in custom tables.
If i had access to the QID i could store it alongside the movement data, making a query like "get all movements for question 2" very simple.
Each question is displayed as a separate page.
I then store all this data in the Limesurvey database in custom tables.
If i had access to the QID i could store it alongside the movement data, making a query like "get all movements for question 2" very simple.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 6 days ago #197481
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 Access QID in twig file?
Try this:
Code:
{{ aQuestion.qid }}
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: DenisChenu, AuPath
The topic has been locked.
- AuPath
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
4 years 5 days ago #197509
by AuPath
Replied by AuPath on topic Access QID in twig file?
{{ aQuestion.qid }} worked, thank you!
The topic has been locked.
- AuPath
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
4 years 5 days ago - 4 years 5 days ago #197519
by AuPath
Replied by AuPath on topic Access QID in twig file?
For anyone else that might have the same problem, an example code snippet:
Code:
<script type="text/javascript" charset="utf-8"> var qid = {{ aQuestion.qid }}; console.log("QID: " + qid); </script>
Last edit: 4 years 5 days ago by AuPath.
The topic has been locked.