Multi-Array dual scale

Mehr
3 Monate 3 Tage her #179431 von Olegna001
COM_KUNENA_MESSAGE_CREATED_NEW
Hi, I’m new to Lime Survey, but doing lots of reading at the moment. I have a challenge to solve.

Can anyone tell me if it is possible to create an Array Dual Scale with multiple fields (not just 2)?

If this is possible, please share your solution?

To explain it further; I’m trying to create a question group. Each question is different, but the sub-questions for each is the same. And to answer the sub-questions I would like to provide the user with drop downs with preset answer options.

Example:

Question Group = Tennis

Q1 = Playing Tennis
Sub Q1a = Do you play? (Drop down = Yes; No)
Sub Q1b = How often?
(Drop down = Daily, Weekly, Monthly)
Sub Q1c = How much time per session (Drop down = 30 min; 45 min; 1 hr; 1:5 hr; 2 hrs; 2.5 hrs or more)

Question Group = Squash
Q2 = Playing Squash
same sub questions as above

Question Group = Golf
Etc...etc...

Appreciate your help.

Also, is it possible to create this solution without custom code? If not, that’s ok, just trying to look for the easiest way to solve this challenge.

Thanks,
AG

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

LimeSurvey Partners
Mehr
3 Monate 2 Tage her #179442 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
You may be able to adapt this workaround to your needs.

- www.limesurvey.org/forum/can-i-do-this-w...list?start=15#173576

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

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Monate 1 Tag her #179448 von Olegna001
COM_KUNENA_MESSAGE_REPLIED_NEW
Hi Tony,

Thanks. I've imported your solution to review and test out. It's great; the general idea is right, however, how do I switch it around? (i.e. I need consistent drop-downs populating down the columns, not across as rows)? Appreciate your help. Apologies, coding isn't my best skill.


Thanks,
AG

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
3 Monate 1 Tag her #179468 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
This example will insert consistent drop-downs in columns:

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
		var thisQuestion = $('#question{QID}');
 
		// Column specific classes
		$('tr.subquestion-list', thisQuestion).each(function(i) {
			$('th, td', this).each(function(i) {
				$(this).addClass('column-'+i);
			});
		});
 
		// Insert selects into column 1
		if($('.answer-item.column-1 .inserted-select', thisQuestion).length == 0) {
			$('.answer-item.column-1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
				<option value="">Please choose...</option>\
				<option value="1">Yes</option>\
				<option value="2">No</option>\
				<option value="3">Do not know</option>\
			</select>');
		} 
 
		// Insert selects into column 2
		if($('.answer-item.column-2 .inserted-select', thisQuestion).length == 0) {
			$('.answer-item.column-2', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
				<option value="">Please choose...</option>\
				<option value="1">Red</option>\
				<option value="2">Blue</option>\
				<option value="3">Pink</option>\
				<option value="3">Purple</option>\
			</select>');  
		} 
 
		// Listeners on select elements
		$('.inserted-select', thisQuestion).on('change', function(i) {
			if($(this).val() != '') {
				$(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change');
			}
			else {
				$(this).closest('.answer-item').find('input:text').val('').trigger('change');
			}
		});
 
		// Returning to page
		$('.with-select input:text', thisQuestion).each(function(i) {
			var thisCell = $(this).closest('.answer-item');
			var inputText = $.trim($(this).val());
			var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val();
			$('select.inserted-select', thisCell).val(selectval);
		});
 
		// Clean-up styles
		$('select.inserted-select', thisQuestion).css({
			'max-width': '100%'
		});
		$('.with-select input:text', thisQuestion).css({
			'position': 'absolute',
			'left': '-9999em'
		});
	});
</script>



Sample survey attached:

Dateianhang:

Dateiname: limesurvey...1223.lss
Dateigröße:28 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Folgende Benutzer bedankten sich: Olegna001

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 4 Wochen her #179570 von Olegna001
COM_KUNENA_MESSAGE_REPLIED_NEW
Hi Tony, this is just what I needed. Works perfectly and I have been able to adapt the code for my needs. Thanks very much!

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 4 Wochen her #179571 von Olegna001
COM_KUNENA_MESSAGE_REPLIED_NEW
Another few questions Tony:
1. How do I make column 1 mandatory to force the user to select either Yes or No?
2. And also, if they select Yes, the remaining columns in that row should be mandatory also, but if they select No, they do not need to complete the remaining columns.
3. Lastly, for the very first column, that does not have a heading, how do I add tooltips for each row?

I believe all of the above can be done through the UI editor, but now as I am dealing with custom code, I assume I need to modify the code to enable this functionality?

Really appreciate your help.

Thanks,
Angelo

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 3 Wochen her #179684 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
1. & 2. This can be done with a question validation equation like this:

(that.Q1.sq_Y001_X001 == 'Yes' OR (that.Q1.sq_Y001_X001 == 'No' AND count(that.Q1.sq_Y001) == 4))
AND
(that.Q1.sq_Y002_X001 == 'Yes' OR (that.Q1.sq_Y002_X001 == 'No' AND count(that.Q1.sq_Y002) == 4))
AND
(that.Q1.sq_Y003_X001 == 'Yes' OR (that.Q1.sq_Y003_X001 == 'No' AND count(that.Q1.sq_Y003) == 4))
AND
(that.Q1.sq_Y004_X001 == 'Yes' OR (that.Q1.sq_Y004_X001 == 'No' AND count(that.Q1.sq_Y004) == 4))


3. In LimeSurvey 3.x, you can use Bootstrap Tooltips . So, something like this in the sub-question text:

<a href="#" data-toggle="tooltip" title="" data-original-title="Tooltip content 1">this has a tooltip</a>



Sample survey attached:

Dateianhang:

Dateiname: limesurvey...2231.lss
Dateigröße:36 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Folgende Benutzer bedankten sich: Olegna001

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 3 Wochen her #179792 von Olegna001
COM_KUNENA_MESSAGE_REPLIED_NEW
Hi Tony,

This is fantastic, thanks very much for your help. Through your support, I’m really enjoying the use of this tool & learning a lot.

One more question if you don’t mind:

4. Is it possible to hide or make the first column (I.e. column 0 in your example above without a heading) width smaller, or so that it adapts to the width of the text contents? For some tables it makes sense to have the first column visible, but for others I don’t need it. Appreciate if you could tell me both methods (I.e. hide completely, or make the width fits cell contents)

Thanks again for your support!

Cheers,
Angelo

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 3 Wochen her #179812 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
There is a question setting for the sub-question width - manual.limesurvey.org/Question_type_-_Ar...subquestion_width.29

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: Olegna001

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 3 Wochen her #179833 von Olegna001
COM_KUNENA_MESSAGE_REPLIED_NEW
Brilliant! Found the setting. Works like a gem - thanks again Tony!

Cheers,
Angelo

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha