- Posts: 19
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Hide text boxes and fix some options at the end in a multi options with comments
- Oterito
- Topic Author
- Offline
- New Member
Less
More
1 year 4 weeks ago #241879
by Oterito
Hide text boxes and fix some options at the end in a multi options with comments was created by Oterito
Please help us help you and fill where relevant:
Your LimeSurvey version: 3.28.54
Own server or LimeSurvey hosting: own
Survey theme/template: vanilla
==================
Hi! I need create a multi options with comments question hiding some of the text boxes and randomize options except the last 4.
I tried this [url] survey-consulting.com/how-to-place-a-cer...t-limesurvey-survey/ [/url]
The code for hide the text boxes works perfectly but the second part for fix the last options doesn’t work.
could anyone help me pleace?
thank you in advance
Your LimeSurvey version: 3.28.54
Own server or LimeSurvey hosting: own
Survey theme/template: vanilla
==================
Hi! I need create a multi options with comments question hiding some of the text boxes and randomize options except the last 4.
I tried this [url] survey-consulting.com/how-to-place-a-cer...t-limesurvey-survey/ [/url]
The code for hide the text boxes works perfectly but the second part for fix the last options doesn’t work.
could anyone help me pleace?
thank you in advance
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 4 weeks ago #241882
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 Hide text boxes and fix some options at the end in a multi options with comments
This script placed in the source of a multiple-choice type question will fix defined items at the end of the list (when order is randomized in the question settings).
You will need to modify the fixedItems values as required.
Sample survey attached:
You will need to modify the fixedItems values as required.
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var fixedItems = ['SQ005', 'SQ006', 'SQ007', 'other']; //// NO EDITING REQUIRED BELOW HERE //// // Identify this question var thisQuestion = $('#question{QID}'); $.each(fixedItems, function(e, code) { $('li[id$="'+code+'"]').appendTo($('.answers-list', thisQuestion)); }); }); </script>
Sample survey attached:
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: Oterito
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
1 year 4 weeks ago #241920
by Oterito
Replied by Oterito on topic Hide text boxes and fix some options at the end in a multi options with comments
Thanks Tony!
I had problems at first because I had the subquestion codes with only numbers, but then I added "SQ..." and ir worked perfectly.
Thank you very much!
I had problems at first because I had the subquestion codes with only numbers, but then I added "SQ..." and ir worked perfectly.
Thank you very much!
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
1 year 4 weeks ago #241945
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 Hide text boxes and fix some options at the end in a multi options with comments
Sorry, I got a little lazy there. This script will handle numeric sub-question codes:
Sample survey:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ var fixedItems = ['5', '6', '7', 'other']; //// NO EDITING REQUIRED BELOW HERE //// // Identify this question var qID = '{QID}'; var thisQuestion = $('#question'+qID); $.each(fixedItems, function(e, code) { $('li[id$="'+qID+code+'"]').appendTo($('.answers-list', thisQuestion)); }); }); </script>
Sample survey:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- Oterito
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
8 months 1 week ago #245761
by Oterito
Replied by Oterito on topic Hide text boxes and fix some options at the end in a multi options with comments
Hi Tony, i am trying to use this code in version 5.6.31 and it doesn't fix the variables at the end. Can you help me? Thanks in advance
Please Log in to join the conversation.