Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Detect if question is answered

  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 day ago #183448 by flobau
Detect if question is answered was created by flobau
Hey,

is there a way i can check if a question has been answered? The intention is to give the user a visual indication when he has completed an answer.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 day ago #183449 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered
?

Adding a string like this
Code:
{if(!is_empty(QCODE.NAOK),"<span class='text-danger'>You don't answer</span>","<span class='text-success'>You answer to this question</span>")}

But more detail can be interesting
manual.limesurvey.org/Expression_Manager

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.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 day ago #183450 by flobau
Replied by flobau on topic Detect if question is answered
Thanks for your answer, that's kinda what i want. Where would i put this line, e.g. where do i have access to
Code:
QCODE.NAOK
?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 day ago #183451 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered

Where would i put this line

Where you want it …

where do i have access to

I put a link : read it …
manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming

It's the code of the question …

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.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 day ago #183453 by flobau
Replied by flobau on topic Detect if question is answered
Thanks. What if i don't know the question code now and i want it for all question codes?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 day ago #183464 by tpartner
Replied by tpartner on topic Detect if question is answered
How would you not know the question codes? You are the survey author.

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
The topic has been locked.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 day ago #183466 by flobau
Replied by flobau on topic Detect if question is answered
Because i don't know yet what survey's i am going to create. I am currently just editing a template, and template are not for a specific surveys i suppose?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 day ago #183467 by tpartner
Replied by tpartner on topic Detect if question is answered
The solution supplied by Denis is to be placed in survey question or group text, not in a template.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 day ago #183471 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered
For template :
Something like this
Code:
{% if(processString("{self.NAOK}") == 0)) %}
You don't answer to this question
{% endif %}
in github.com/LimeSurvey/LimeSurvey/blob/ma..._text_container.twig for example

See manual.limesurvey.org/Theme_editor

I don't answer to next question if you don't explain more what do you want exactly and what did you try …

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.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 1 day ago #183475 by flobau
Replied by flobau on topic Detect if question is answered
Thank you Denis!
I didn't know that you can do that inside a survey question or group text, sorry for that. And sorry for my bad explanation.
The topic has been locked.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #183718 by flobau
Replied by flobau on topic Detect if question is answered
Code:
{% if(processString("{self.NAOK}") != 0) %}
        <span>question answered</span>
{% endif %}

I tried this code, but the condition is never true. My goal is to show a visual indication after the user successfully chose a answer from a single choice question - in the moment the user clicks on an answer.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago - 4 years 11 months ago #183720 by tpartner
Replied by tpartner on topic Detect if question is answered
Try:

Code:
{% if(processString("{!is_empty(self)}")) %}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 11 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose