Welcome to the LimeSurvey Community Forum

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

Detect if question is answered

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #183828 by tpartner
Replied by tpartner on topic Detect if question is answered
Nice!

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • flobau
  • flobau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago - 4 years 11 months ago #183880 by flobau
Replied by flobau on topic Detect if question is answered
Thanks for your answers guys! I tried Denis's solution, but
Code:
count(self.NAOK)
stays always 0 for me. I used the exact same code as you in my template.
Code:
{% set questionCount = processString("{count(self.question)}") %}
    count(self.question): {{ questionCount }} <br>
    count(self.NAOK): {{ processString("{count(self.NAOK)}") }} <br>
    {{ processString("{if(count(self.NAOK) == 0,'<span class=\"text-danger\">No question answered</span>')}")  }}
    {{ processString("{if(count(self.NAOK) gt 0 and count(self.NAOK) lt "~questionCount~",'<span class=\"text-warning\">'+count(self.NAOK)+' question(s) answered</span>')}")  }}



Here you can see, that self.NAOK is always 0, even when i answered the question.
Last edit: 4 years 11 months ago by flobau.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #183881 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered
Maybe a js issue, but you don't tell : LimeSurvey version and build number, if you use vanilla theme without ajax mode etc …

I can track down your issue and help you more.

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
4 years 11 months ago - 4 years 11 months ago #183882 by flobau
Replied by flobau on topic Detect if question is answered
We are using LimeSurvey Version 3.17.0. I don't know where to find the build number.


The theme is extended from vanilla theme.

edit: Ajax Mode is on.
Last edit: 4 years 11 months ago by flobau.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #183885 by tpartner
Replied by tpartner on topic Detect if question is answered

Ajax Mode is on.

ALWAYS disable AJAX. In my opinion, it does nothing other than cause problems.

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
4 years 11 months ago - 4 years 11 months ago #183887 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered

tpartner wrote:

Ajax Mode is on.

ALWAYS disable AJAX. In my opinion, it does nothing other than cause problems.

Here, it seems to work with ajax on .

But possible other issue
1. Difference between 3.17.0 and 3.17.2, i don't think but …
2. Another issue in the survey that broke javascript.

EDIT : with or witout ajax mode : it don't work when reload or try to submit

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: 4 years 11 months ago by DenisChenu. Reason: EDIT
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #184012 by DenisChenu
Replied by DenisChenu on topic Detect if question is answered

DenisChenu wrote:
EDIT : with or witout ajax mode : it don't work when reload or try to submit

Git it,

Since self.question seems broken when reload : JS .question broken, then using it as static var.
Code:
{% set questionCount = processString("{count(self.question)}",1,1) %}

Proof of concept (i deactivate setCustomValidty) : demo.sondages.me/483539 .

After : some other need to be done
- Other is inside .question but are not always mandatory.
- Array filter : maybe using .relevanceStatus and not .question can fix this issue ? Unsure what happen for _other.relevanceStatus and _comment.relevanceStatus

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.

Lime-years ahead

Online-surveys for every purse and purpose