Hide specific comment box in multiple choice with comment

More
11 months 2 weeks ago #188253 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
Attachments:

Please Log in to join the conversation.

LimeSurvey Partners
More
11 months 2 weeks ago #188255 by tpartner
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.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
11 months 2 weeks ago #188256 by Spix
You're right. Here you go
Attachments:

Please Log in to join the conversation.

More
11 months 2 weeks ago #188260 by tpartner
Add something like this to the question source:

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

File Attachment:

File Name: limesurvey...2183.lss
File Size:21 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
The following user(s) said Thank You: Spix

Please Log in to join the conversation.

More
11 months 2 weeks ago #188291 by Spix
Thanks a lot. Works perfectly.

Please Log in to join the conversation.

More
10 months 3 weeks ago #188908 by surveySn
Hi Tpartner

How to add different suffixes?

Please Log in to join the conversation.

More
10 months 3 weeks ago #188915 by tpartner
Try this:

<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.
Official LimeSurvey Partner - partnersurveys.com

Please Log in to join the conversation.

More
10 months 3 weeks ago #189009 by surveySn
Perfect, thank you,Tpartner

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now