Titles for subquestions

More
10 months 9 hours ago #147293 by cstcandy
cstcandy created the topic: Titles for subquestions
Hi there.

1) I would like to add and display subtitles to divide the sub-questions into several groups, so that it will be more reader-friendly and respondents can easily find their answers. If there is a solution, would it be different for multiple choice VS. list radio question?
For example, if the question is "Which country do you live in?.", the sub-questions will be displayed in the way like:
Asia
China □
Taiwan □
Thailand □
Singapore □
Malaysia □
Europe
UK □
USA □

2) If I would like to have randomization within each groups of subquestions, are there any solutions?


Appreciated for any response. :)

Please Log in to join the conversation.

More
10 months 8 hours ago #147305 by LouisGac
LouisGac replied the topic: Titles for subquestions
can be done with JavaScript.

Please Log in to join the conversation.

More
10 months 3 hours ago #147320 by DenisChenu
DenisChenu replied the topic: Titles for subquestions
Easy without 2 (randomization) : there are surely some published workarounds in manual

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
10 months 3 hours ago #147325 by Ben_V
Ben_V replied the topic: Titles for subquestions

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

More
9 months 4 weeks ago #147359 by holch
holch replied the topic: Titles for subquestions
@Ben_V: I tried the solution posted there (from Tpartner) and it wohnt work in LS 2.59.1. I guess the solution is for the 2.06 / 2.6 branch?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
9 months 4 weeks ago #147361 by Ben_V
Ben_V replied the topic: Titles for subquestions
Probably some selectors have changed..but sounds easy to adapt. This said, I cannot test because I do not have the recent cited version installed anywhere.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)

Please Log in to join the conversation.

More
9 months 4 weeks ago - 9 months 4 weeks ago #147371 by cstcandy
cstcandy replied the topic: Titles for subquestions
I have tried the following script. Can I assume the number in bracket "eq(#)" is the row of the subtitle? I have modified the numbers according to my survey and didn't change anything else (sorry I am not familar with JS). It is not working, which my survey still displays the answer options as usual.
<script charset="utf-8" type="text/javascript">      
	$(document).ready(function() {  
 
		$( '#question{QID} li.question-item:eq(0) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(5) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(10) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(15) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(19) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(23) input.checkbox').css ({                     
			'display': 'none' 
		});
		$( 'question{QID} li.question-item:eq(29) input.checkbox').css ({                     
			'display': 'none' 
		});
	});
</script>
Last Edit: 9 months 4 weeks ago by DenisChenu. Reason: spoiler => code

Please Log in to join the conversation.

More
9 months 4 weeks ago #147372 by cstcandy
cstcandy replied the topic: Titles for subquestions
Sorry, didn't manage to paste the script properly.

Please Log in to join the conversation.

More
9 months 4 weeks ago #147377 by cstcandy
cstcandy replied the topic: Titles for subquestions
I just tried the script and use default template in my survey. The script works!
So I wonder it is the problem of my designed template. Any specific script to be added in the template.css?

Thanks!

Please Log in to join the conversation.

More
9 months 4 weeks ago - 9 months 4 weeks ago #147393 by tpartner
tpartner replied the topic: Titles for subquestions
In version 2.5x, there are pseudo-elements inserted for the check-boxes and you can't reliably use JavaScript to apply styles to a pseudo-element.

The simplest approach is to apply classes to the row elements and target the pseudo-elements in those rows with CSS. You should also remove the check-boxes in those rows in case someone tabs through the question.

1) Add something like this to the question source:
<script type="text/javascript" charset="utf-8">		
 
	$(document).ready(function() {
		// First Row
		$('#question{QID} .question-item:eq(0)').parent().addClass('sub-header');
		$('#question{QID} .question-item:eq(0)').find('input').remove();
		// Sixth Row
		$('#question{QID} .question-item:eq(5)').parent().addClass('sub-header');
		$('#question{QID} .question-item:eq(5)').find('input').remove();
		// Tenth Row
		$('#question{QID} .question-item:eq(11)').parent().addClass('sub-header');
		$('#question{QID} .question-item:eq(11)').find('input').remove();
	});
</script>

2) Add something like this to the end of template.css:
.multiple-opt .sub-header .question-item {
	padding-left: 0;
}
 
.multiple-opt .sub-header .label-text {
	margin-left: 0;
	font-weight: bold;
}
 
.multiple-opt .sub-header .checkbox label::before {
	display: none;
}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 9 months 4 weeks ago by tpartner.
The following user(s) said Thank You: Ben_V, LouisGac

Please Log in to join the conversation.

More
9 months 4 weeks ago #147412 by holch
holch replied the topic: Titles for subquestions
I think we should have such titles as a feature in Limesurvey, especially for multi answer, list radio and Array.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: cstcandy

Please Log in to join the conversation.

More
9 months 4 weeks ago #147471 by cstcandy
cstcandy replied the topic: Titles for subquestions
Thanks for your help.
But it still doesn't work in my own template... (I am not the one who designed the template so I cannot find out the problem niether.)

Please Log in to join the conversation.

More
9 months 4 weeks ago #147474 by cstcandy
cstcandy replied the topic: Titles for subquestions
Hi all, I have another solution for the sake of displaying sub-titles.
I use the following script to "hide" the checkbox of particular codes.
The Blankbutton.png is a transparent picture and saved in the template editor.

My next question - is it possible to randomize the answers within groups and then randomize between groups? Thanks so much!

<script type="text/javascript" charset="utf-8">

$(document).ready(function(){

var templatePath = $('head link[href*="template.css"]').attr('href').replace(/template.css/, '');

// Apply images to Group 1 $("input#answerYYYYXYYYYXYYYYYY").imageTick({

// Image to use as a selected state of the checkbox
tick_image_path: templatePath+"Blankbutton.png",
// Image to use as a non-selected state
no_tick_image_path: templatePath+"Blankbutton.png",
// Class to apply to all checkbox images that are dynamically created
image_tick_class: "checkboxes"
});
});

</script>

Please Log in to join the conversation.

More
9 months 4 weeks ago #147485 by tpartner
tpartner replied the topic: Titles for subquestions

My next question - is it possible to randomize the answers within groups and then randomize between groups? Thanks so much!

You could do that with with JavaScript but without knowing the structure of your template it's impossible to give a code example.

An alternative may be to use several questions and CSS to make them appear as one. Again without template details it's impossible to give a code example.

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.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!