Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: modifying "array dual scale" questions

modifying "array dual scale" questions 3 years 4 months ago #94021

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6134
  • Thank you received: 1362
  • Karma: 535
Okay, in 1.92, set the question to non-mandatory and use this script. In addition to the above behaviour, it will:

1) Uncheck and hide the "No Answer" options
2) Pop up an alert and abort the submit function if a row is unanswered.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		function moveRowLabels(qID) {
			var alertMsg = 'One or more mandatory questions have not been answered. You cannot proceed until these have been completed.';
			// Add some classes
			$('#question'+qID+' table.question tbody td').not('.dual_scale_separator').addClass('answer-item radio-item');
			// Hide the first column
			$('#question'+qID+' th.header_answer_text, #question'+qID+' th.answertext').hide();
			// Uncheck and hide the "No Answer" columns
			$('#question'+qID+' .header_no_answer').hide().prev().hide('header_separator');
			$('#question'+qID+'[value=""]').attr('checked', false).closest('td').hide().prev().hide('header_separator');
			// 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').click(function() {
				var parentRow = $(this).closest('tr');
				$('.active', parentRow).removeClass('active');
				$('', parentRow).not('.active').attr('checked', false);
			$('#question'+qID+' table.question').click(function(event) {
				var parentRow = $(this).closest('tr');
				$('.active', parentRow).removeClass('active');
				$('', this).addClass('active');
				$('', parentRow).not('.active').attr('checked', false);
			// At least one radio clicked per row
			// Interrupt the submit function
			$('#movenextbtn, #movesubmitbtn').click(function(){
				var error = 0;
				$('#question'+qID+' table.question tbody.error').removeClass('error');
				$('#question'+qID+' table.question tbody').each(function(i){
					if($('', this).length == 0) {
						error = 1;
				if(error == 1) {
					return false;

And then use something like this at the end of template.css:
.moveRowLabelsQ table.question tbody td.answer-item { /* radio cells */
	width: 30px;
.moveRowLabelsQ table.question  td.dual_scale_separator { /* question cell */
	width: 80px;
.moveRowLabelsQ table.question tbody.error td.answer-item { /* Error cells */
background: pink;
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.242 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form