Welcome to the LimeSurvey Community Forum

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

Limiting Answers in Arrays

  • BBCMResearch
  • BBCMResearch's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 7 months ago #141399 by BBCMResearch
Limiting Answers in Arrays was created by BBCMResearch
Apologies, because I'm pretty sure this has been asked and answered before - I just couldn't find the appropriate threads.

I have an array of 5 subquestions SQ1-SQ5.

I have 8 answers - a 7 point lickert scale plus N/A.

However, N/A is not a relevant answer option for SQ1-SQ4.
How do I limit my last answer option (N/A) to be selectable only in SQ5, but not in any of the other subquestions?

Using Version 2.50+160901.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago #141437 by tpartner
Replied by tpartner on topic Limiting Answers in Arrays
Add something like this to the question source:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function(){      
    $('#question{QID} tr.answers-list:lt(4) .answer-item:last-child *').remove();
  });
</script>

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: BBCMResearch
The topic has been locked.
  • BBCMResearch
  • BBCMResearch's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 7 months ago #141465 by BBCMResearch
Replied by BBCMResearch on topic Limiting Answers in Arrays
Thank you!
How might it look if I wanted the final N/A answer option to only be selectable for SQ4, but not SQ1-SQ3 OR SQ5?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 7 months ago #141467 by tpartner
Replied by tpartner on topic Limiting Answers in Arrays
Try this:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function(){      
    $('#question{QID} tr.answers-list:not(:eq(3)) .answer-item:last-child *').remove();
  });
</script>

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: BBCMResearch
The topic has been locked.
  • BBCMResearch
  • BBCMResearch's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 7 months ago #141468 by BBCMResearch
Replied by BBCMResearch on topic Limiting Answers in Arrays
Perfect!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose