Array question with no subquestion - space problem

4 years 6 months ago #85190 by kevouze
Hey everyone,
I am designing a survey for my PhD in which I have several Likert scale-type single questions. To do such things, some forum posts recommend to use an Array question, with no sub-question (or rather entering a space character for the first default subquestion) and to set the answer width to 1.

With the template that I am using, this option leaves some blank space where the sub-question shall be which is not that nice... I have spent quite some time playing with the different settings and the CSS template, but without success.

I have attached a screenshot of the issue.

Any magic trick?



Please Log in to join the conversation.

4 years 1 week ago #94128 by arpsh
Bumping an old topic :)

I have exactly the same problem as the OP, and have similarly played round with the CSS for the template I am using (Limespired) without success.

It is obviously quite common to do single line likert scales, and for the respondents it is very useful for this to be in the same format to when they also appear in a bank. Has anyone ever had any joy working this one out in CSS, or built a new 'single line array' question type?


Please Log in to join the conversation.

4 years 1 week ago #94153 by tpartner
If using LS 2.0, add this to the end of template.css. Replace "QQ" with the array question ID .
#questionQQ .subquestions-list thead td,
#questionQQ .subquestions-list tbody th {
    display: none;

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

Please Log in to join the conversation.

3 years 11 months ago #94435 by arpsh
Thanks tpartner :)

I had found another workaround before, but this works better. I have added it to the source of the question itself, so for the benefit of others the code to do that is (again replacing QQ with the question ID:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
	$( 'div#questionQQ table.subquestions-list thead td' ).css({ 'display':'none' }); 
	$( 'div#questionQQ table.subquestions-list tbody th' ).css({ 'display':'none' }); 

This solution does what it says on the tin, but this does mean that the row of response items is left justified and not full width (at least in the limespired template). That might be fine for you, but if, like me, you would prefer them to be full width you can use the following longer code, which I adapted slightly from one of the workarounds in the wiki manual:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
	// Hide sub questions
	$( 'div#questionQQ table.subquestions-list thead td' ).css({ 'display':'none' }); 
	$( 'div#questionQQ table.subquestions-list tbody th' ).css({ 'display':'none' }); 
	// Get rid of all the widths that the API imposes
	$( 'div#questionQQ table.question col' ).attr('width', '');
	$( 'div#questionQQ table.question thead td' ).attr('width', '');
	// Define a width for the question table so we can do so for its children
	// NOTE: Original code suggested to keep this to 95% or less so IE will behave. 
	// It SEEMS to work OK in limespired template at 100%, but check carefully.
	$( 'div#questionQQ table.question' ).attr('width', '100%');
	// Define the column widths
	// Add or remove columns and adjust widths as necessary but widths should add up to 100%
	// NOTE: Columns must be sequentially numbered starting at 0 - eg, td:eq(0), td:eq(1), td:eq(2).....
	$( 'div#questionQQ table.question tbody td:eq(0)' ).css({ 'width':'20%' }); // First answer column
	$( 'div#questionQQ table.question tbody td:eq(1)' ).css({ 'width':'20%' }); // Second answer column
	$( 'div#questionQQ table.question tbody td:eq(2)' ).css({ 'width':'20%' }); // Third answer column
	$( 'div#questionQQ table.question tbody td:eq(3)' ).css({ 'width':'20%' }); // Fourth answer column
	$( 'div#questionQQ table.question tbody td:eq(4)' ).css({ 'width':'20%' }); // Fifth answer column

I hope someone else finds this useful too!

Please Log in to join the conversation.