- Posts: 16
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Hide specific comment box in multiple choice with comment
- Spix
- Topic Author
- Offline
- New Member
Less
More
4 years 7 months ago #188253
by Spix
Hide specific comment box in multiple choice with comment was created by Spix
Hi Tony and all others.
I have a multiple choice question with comment, where I ask for the length of a tried treatment in months. One of the options is "no treatment tried" where the comment box, asking for the duration is redundant. I would like to get rid of that one specifically.
While were on it. Is there a way to have a "months" suffix behind the comment boxes?
Cheers,
Max
I have a multiple choice question with comment, where I ask for the length of a tried treatment in months. One of the options is "no treatment tried" where the comment box, asking for the duration is redundant. I would like to get rid of that one specifically.
While were on it. Is there a way to have a "months" suffix behind the comment boxes?
Cheers,
Max
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 7 months ago #188255
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 specific comment box in multiple choice with comment
Please always attach a survey export (.lss file) containing the relevant question(s) so we don't have to spend time creating surveys.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Spix
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188256
by Spix
Replied by Spix on topic Hide specific comment box in multiple choice with comment
You're right. Here you go
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 7 months ago #188260
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 specific comment box in multiple choice with comment
Add something like this to the question source:
You will also need to change the "Text input box width" to something like 50% to get it to look decent.
Sample survey attached:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Remove the first comment box $('#question{QID} ul.ls-answers li:eq(0) .comment-item').remove(); // Insert comment suffix var suffixText = 'months'; $('#question{QID} .comment-item').append('<span class="comment-suffix">'+suffixText+'</span>'); }); </script> <style type="text/css"> #question{QID} input[type="text"] { width: auto; display: inline-block; } </style>
You will also need to change the "Text input box width" to something like 50% to get it to look decent.
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: Spix
The topic has been locked.
- Spix
- Topic Author
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 0
4 years 7 months ago #188291
by Spix
Replied by Spix on topic Hide specific comment box in multiple choice with comment
Thanks a lot. Works perfectly.
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
4 years 7 months ago #188908
by surveySn
Replied by surveySn on topic Hide specific comment box in multiple choice with comment
Hi Tpartner
How to add different suffixes?
How to add different suffixes?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
4 years 7 months ago #188915
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 specific comment box in multiple choice with comment
Try this:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ // Remove the first comment box $('#question{QID} ul.ls-answers li:eq(0) .comment-item').remove(); // Insert comment suffixes $('#question{QID} .comment-item:eq(0)').append('<span class="comment-suffix">Suffix 1</span>'); $('#question{QID} .comment-item:eq(1)').append('<span class="comment-suffix">Suffix 2</span>'); $('#question{QID} .comment-item:eq(2)').append('<span class="comment-suffix">Suffix 3</span>'); }); </script> <style type="text/css"> #question{QID} input[type="text"] { width: auto; display: inline-block; } </style>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
4 years 7 months ago #189009
by surveySn
Replied by surveySn on topic Hide specific comment box in multiple choice with comment
Perfect, thank you,Tpartner
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
1 week 4 days ago #260329
by Mazi
Demo: plugins.mysurveyhosting.com/index.php/344631?newtest=Y&lang=en
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Hide specific comment box in multiple choice with comment
This can be done easily with the following plugin which allows to define which options should not have a comment box shown: survey-consulting.com/product/multi-opti...e-limesurvey-plugin/I have a multiple choice question with comment, where I ask for the length of a tried treatment in months. One of the options is "no treatment tried" where the comment box, asking for the duration is redundant. I would like to get rid of that one specifically.
Demo: plugins.mysurveyhosting.com/index.php/344631?newtest=Y&lang=en
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.