Access QID in twig file?

More
2 months 2 weeks ago - 2 months 2 weeks ago #197449 by AuPath
Is it possible to have access to the qid for the current question in the theme's question.twig file?
I tried
'{{ processString('{QID}') }}'
but it does not seem to work.
Last edit: 2 months 2 weeks ago by AuPath.

Please Log in to join the conversation.

LimeSurvey Partners
More
2 months 2 weeks ago #197475 by tpartner
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?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
2 months 2 weeks 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.

Please Log in to join the conversation.

More
2 months 2 weeks ago #197481 by tpartner
Replied by tpartner on topic Access QID in twig file?
Try this:

{{ aQuestion.qid }}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: DenisChenu, AuPath

Please Log in to join the conversation.

More
2 months 2 weeks ago #197509 by AuPath
Replied by AuPath on topic Access QID in twig file?
{{ aQuestion.qid }} worked, thank you!

Please Log in to join the conversation.

More
2 months 2 weeks ago - 2 months 2 weeks 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:
<script type="text/javascript" charset="utf-8">
	var qid = {{ aQuestion.qid }};
	console.log("QID: " + qid);
</script>
Last edit: 2 months 2 weeks ago by AuPath.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now