Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: modifying "array dual scale" questions

modifying "array dual scale" questions 1 year 7 months ago #93931

Hi there,
I have a question about the formatting of "array dual scale" questions.

I have a couple of questions where people have to decide whether to give answers on one or the other scale (the scaales have different consequences - with their answers participants are helping one person or the other). After having tried various things, using an "array dual scale" seems to be the best solution.

Based on another post on the forum (www.limesurvey.org/en/forum/design-issue...n-range?limitstart=0) I created my question in the following order:

"scale 1 - question - scale 2"
I have attached a screenshot of an example question.




Now I would like to adjust the width of the question box, but I cannot find a solution to that (in the advanced settings you can change the "answer width" but that changes the width of the first column).

Also, I would like that people can only give one anwser - either scale 1 or scale 2
What I would basically need is what you have with "normal" radio buttons, that if you check a second radio button, it automatically unchecks the first one.

I tried this by making it a MaxDiff question (docs.limesurvey.org/tiki-index.php?page=...axDiff_question_type), where it is indeed possible to give one answer only, but then the problem is that people can not change their answer.

I figured both questions would have rather simple solutions - somewhere in the code, but I after numerous searches, I cannot find it.

Thanks for your help!
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93935

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2852
  • Thank you received: 360
  • Karma: 125
No screenshot attached. Watch out for the file limits (I think it is something like 800x600px) or something.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93938

Oh, thanks, did not even notice it yet. Hope it works this way


Limesurvey-example.jpg
Last Edit: 1 year 7 months ago by jvandernoll. Reason: attach file
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93939

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2852
  • Thank you received: 360
  • Karma: 125
Hahahaha, now you can hardly see anything. ;-)

Try to cut out only the important question part and leave the rest out.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
Last Edit: 1 year 7 months ago by holch.
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93947

I keep on trying... :)
Somehow it is rally reluctant to upload my attachments - in the previews it is there, but in the submitted post it isn't ...
I've also attached (I hope..) the file that you get when you "export this question"
Attachments:
Last Edit: 1 year 7 months ago by jvandernoll.
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93976

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
I've tweaked your script a bit to:

1) Automatically detect the question ID
2) Add a specific class to the question (that can be used in template.css)
3) Reset the column widths imposed by LimeSurvey
4) Only allow one radio checked per row

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() { 
 
		moveRowLabels({self.qid});
 
		function moveRowLabels(qID) {
 
			// Add a class for the question
			$('#question'+qID).addClass('moveRowLabelsQ');
 
			// Hide the first column
			$('#question'+qID+' th.header_answer_text, #question'+qID+' th.answertext').hide();
 
			// Insert the subquestion text into the scale separators
			$('#question'+qID+' table.question tbody').each(function(i){
				$('.dual_scale_separator:eq(0)', this).text($('.answertext', this).text());
			});
 
			// Reset the column widths
			$('#question'+qID+' col').css({ 'width':'auto' });
 
			// Only one radio clicked allowed per row
			$('#question'+qID+' table.question input.radio').click(function() {
				var parentRow = $(this).closest('tr');
				$('.active', parentRow).removeClass('active');
				$(this).addClass('active');
				$('input.radio', parentRow).not('.active').attr('checked', false);
			});			
			$('#question'+qID+' table.question td.radio-item').click(function(event) {
				var parentRow = $(this).closest('tr');
				$('.active', parentRow).removeClass('active');
				$('input.radio', this).addClass('active');
				$('input.radio', parentRow).not('.active').attr('checked', false);
			});
		}
    });
</script>


Now you can add something like this to the end of template.css to set the column widths:
.moveRowLabelsQ td.answer-item { /* radio cells */
	width: 30px;
}
 
.moveRowLabelsQ td.information-item { /* question cell */
	width: 80px;
}

Capture3_2013-03-19.JPG
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: blacknail

modifying "array dual scale" questions 1 year 7 months ago #93978

Thanks a lot Tony!!

For the first part, it did not automatically detect the question ID, but once I filled that in in the place of {self.qid} it works perfectly. :-)

The second part does not work right away, I guess I need to take a little bit more time for that to figure the template.css language out.

Jolanda.
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #93980

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
The second part does not work right away, I guess I need to take a little bit more time for that to figure the template.css language out.
Can you activate a test so we can see the source code?
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.

modifying "array dual scale" questions 1 year 7 months ago #94007

With "activate a test" I assume you meant to activate a survey, right? I think I just use the standard template.

Here it is: tools.uclouvain.be/limesurvey191/index.php?sid=74427&lang=en

I noticed another thing, if I set the question to mandatory, I get an error that not all mandatory questions are answered (I guess that is because one of the scales is "missing" an answer). I would prefer to set the question as mandatory, or at least not to have the "no answer" box showing up. Any suggestions there?

Thanks again!
The administrator has disabled public write access.

modifying "array dual scale" questions 1 year 7 months ago #94010

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
Oh, I see you are using LS 1.91. My script modifications are for LS 2.0.

I'll need to rework a couple of things...
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.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.131 seconds
Donation Image