Welcome to the LimeSurvey Community Forum

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

Multiple choice subquestion logic

More
10 years 4 months ago #101665 by rui_b
Multiple choice subquestion logic was created by rui_b
Hello all,

is it possible to filter/exclude subquestions in a multiple choice type, according to a token attribute?

Ex: I want to exclude subquestion 2, if TOKEN:attribute_1 == 1

Best regards
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago - 10 years 4 months ago #101668 by tpartner
Replied by tpartner on topic Multiple choice subquestion logic
Untested, but placing this in the source of the multiple-choice question should do the trick:

Code:
<script type="text/javascript" charset="utf-8">  
  var attribute_1 = '{TOKEN:ATTRIBUTE_1}';
 
  $(document).ready(function() { 
 
    if(attribute_1 == 1) {
      // Hide the second sub-question      
      $('#question{QID} .question-item:eq(1)').hide();
    }
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 4 months ago by tpartner.
The following user(s) said Thank You: rui_b
The topic has been locked.
More
10 years 4 months ago #101672 by rui_b
Replied by rui_b on topic Multiple choice subquestion logic
Thank you for the quick response!

Isn't it possible to do it through relevance equation or array filter? Or even in the sub-question title by using an expression?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 4 months ago #101673 by tpartner
Replied by tpartner on topic Multiple choice subquestion logic
Not as far as I know.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose