- Posts: 22
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Anchoring subquestion in multiple choice question
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
3 years 9 months ago #201537
by jfrey1
Anchoring subquestion in multiple choice question was created by jfrey1
Hello. I'd like to know how to anchor a subquestion in a multiple choice question using randomization. Attached is a test survey containing 2 examples of this scenario:
Test question #1: contains 4 subquestions
Test question #2: contains 5 subquestions, including an exclusive option ("None of the above"), which is automatically anchored; in this question, I'd like to anchor "Other" above "None of the above" in the list
Any questions, just let me know.
Lime version: Version 4.3.0+200616
Test question #1: contains 4 subquestions
Test question #2: contains 5 subquestions, including an exclusive option ("None of the above"), which is automatically anchored; in this question, I'd like to anchor "Other" above "None of the above" in the list
Any questions, just let me know.
Lime version: Version 4.3.0+200616
Attachments:
The topic has been locked.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
3 years 9 months ago #201885
by jfrey1
Replied by jfrey1 on topic Anchoring subquestion in multiple choice question
Can someone help me out please?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
3 years 9 months ago #201890
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Anchoring subquestion in multiple choice question
Question 1, something like this in the script field:
Question 2, something like this in the script field:
Sample survey attached:
Code:
// Sub-question code to be fixed at the bottom var fixedCode = '4'; // Move the sub-question $('#question{QID} .answers-list >ul:eq(0)').append($('#question{QID} li[id^="javatbd"][id$="X{QID}'+fixedCode+'"]'));
Question 2, something like this in the script field:
Code:
// Sub-question code to be fixed at second-bottom var fixedCode = '4'; // Move the sub-question $('#question{QID} li[id^="javatbd"]:last').before($('#question{QID} li[id^="javatbd"][id$="X{QID}'+fixedCode+'"]'));
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
3 years 9 months ago #201891
by jfrey1
Replied by jfrey1 on topic Anchoring subquestion in multiple choice question
How do I access the script field to add code to a question? I imported the attached test survey, and I see the script in "Question overview" mode, but when I switch to "Question editor," the script is replaced with the "Help" entry field.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10635
- Thank you received: 3699
3 years 9 months ago - 3 years 9 months ago #201892
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Anchoring subquestion in multiple choice question
You may not have permissions to insert scripts.
Try this in the question source:
More about inserting JS here - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey
Try this in the question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Sub-question code to be fixed at the bottom var fixedCode = '4'; // Move the sub-question $('#question{QID} .answers-list >ul:eq(0)').append($('#question{QID} li[id^="javatbd"][id$="X{QID}'+fixedCode+'"]')); }); </script>
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Sub-question code to be fixed at second-bottom var fixedCode = '4'; // Move the sub-question $('#question{QID} li[id^="javatbd"]:last').before($('#question{QID} li[id^="javatbd"][id$="X{QID}'+fixedCode+'"]')); }); </script>
More about inserting JS here - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 9 months ago by tpartner.
The topic has been locked.
- jfrey1
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 22
- Thank you received: 0
3 years 9 months ago #201894
by jfrey1
Replied by jfrey1 on topic Anchoring subquestion in multiple choice question
This works, thanks!
The topic has been locked.