Welcome, Guest
Username: Password: Remember me

TOPIC: Array question with no subquestion - space problem

Array question with no subquestion - space problem 1 year 10 months ago #85190

  • kevouze
  • kevouze's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
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.

array-spaceProblem.jpg


Any magic trick?

Thanks,

Kevin
The administrator has disabled public write access.

Array question with no subquestion - space problem 1 year 4 months ago #94128

  • arpsh
  • arpsh's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
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?

Thanks
Adam
The administrator has disabled public write access.

Array question with no subquestion - space problem 1 year 4 months ago #94153

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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;
}
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: arpsh

Array question with no subquestion - space problem 1 year 4 months ago #94435

  • arpsh
  • arpsh's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
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' }); 
});
</script>

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
 
});
</script>

I hope someone else finds this useful too!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.142 seconds
Donation Image