Welcome, Guest
Username: Password: Remember me

TOPIC: Multiple choice subquestion logic

Multiple choice subquestion logic 10 months 4 days ago #101665

  • rui_b
  • rui_b's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
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 administrator has disabled public write access.

Multiple choice subquestion logic 10 months 4 days ago #101668

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
Untested, but placing this in the source of the multiple-choice question should do the trick:

<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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 10 months 4 days ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: rui_b

Multiple choice subquestion logic 10 months 4 days ago #101672

  • rui_b
  • rui_b's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
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 administrator has disabled public write access.

Multiple choice subquestion logic 10 months 4 days ago #101673

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4195
  • Thank you received: 789
  • Karma: 359
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.116 seconds
Donation Image