Exclusive columns in one array + mixture of text and checkbox input?

Mehr
7 Monate 3 Wochen her #183577 von PaulMRFGR
Hi there,

Wondering if it's possible to do this question on Lime Survey. It's difficult to explain so I've taken a screenshot of the desired question (which has been created using a different survey system).

Is there anyway to replicate this on Limesurvey?



Obviously respondents should only be able to select one option each for the Gender and Employment Status sections of the array.

Thank you.
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
7 Monate 3 Wochen her #183578 von Joffm
Example with drop-downs instead of radios.

It's smaller.




sample survey with more examples (Q1c is this one)

Dateianhang:

Dateiname: limesurvey...1969.lss
Dateigröße:43 KB


Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183584 von PaulMRFGR
Hey,

Thanks for this - it's really useful. Could you let me know what question type / settings you're using (only the import isn't working for some reason). Thanks!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183588 von Joffm
Hi, the question type is array(text).
The javascript you find in the question code.

BUT:
Which LS version are you using?
The import isn't working?
No message, nothing? Just a white page?

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183590 von PaulMRFGR
When I try to import, I'm getting the following error message:

Property "SurveyLanguageSetting.surveyls_policy_notice" is not defined.
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183594 von Joffm
Though you still did not tell us your LS version, I am sure it is an old one.
Because in LS version 3.xx the data policy messages were included.
Therefore it is essential that the first information is the LS version.

There are some posts here how to import these *.lss files.
You just have to remove all lines in the file that contain something about the data policy.


I could try to adapt this to LS branch 2.50-2.73.
But not before I am sure you use this and not something like 1.92, 2.05, 2.06/2.6.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183595 von PaulMRFGR
You're correct - just checked and we're version 2.05. Any way we could adapt the file? Thanks!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her - 7 Monate 3 Wochen her #183598 von Joffm
Well, the latest build of 2.05 was LimeSurvey 2.05+ build 141229 (nearly four and a half year ago)
You should really consider an update. Not only for security reasons.

In the meantime the template system changed twice. Many features were added, which the script relies on.

It's a simple question of type "array(text)".
Here is the code of the included javascript, which IMHO is easy to understand.

Maybe you are able to adapt. I am not.
<script type="text/javascript" charset="utf-8">
	$(document).on('ready pjax:scriptcomplete',function(){
		var thisQuestion = $('#question{QID}');
 
		// Insert selects
		$('.answer-item.answer_cell_X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
													<option value="">Please choose...</option>\
													<option value="1">male</option>\
													<option value="2">female</option>\
													<option value="3">other</option>\
													<option value="4">DK/NA</option>\
												</select>'); 
		$('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
													<option value="">Please choose...</option>\
													<option value="1">Employed full time</option>\
													<option value="2">Employed part time</option>\
													<option value="3">3</option>\
													<option value="4">4</option>\
													<option value="5">5</option>\
												</select>'); 
 
		// Listeners
		$('.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>

Joffm

There is a plugin "arrayTextAdapt"
https://extensions.sondages.pro/questions-updating-and-managing/arraytextadapt/
The newest version is in the LimeStore.
The development started in 2016. So maybe there is a version for LS2.05


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 7 Monate 3 Wochen her von Joffm.
Folgende Benutzer bedankten sich: DenisChenu

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183612 von DenisChenu

Joffm schrieb: …
The development started in 2016. So maybe there is a version for LS2.05

The last one : no.

But old one yes : gitlab.com/SondagesPro/QuestionSettingsType/arrayTextAdapt/tags

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her - 7 Monate 3 Wochen her #183617 von tpartner
This slightly modified script will work in 2.05:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
		var thisQuestion = $('#question{QID}');
 
		// Insert selects
		$('.answer-item.answer_cell_00X003', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
													<option value="">Please choose...</option>\
													<option value="1">male</option>\
													<option value="2">female</option>\
													<option value="3">other</option>\
													<option value="4">DK/NA</option>\
												</select>'); 
		$('.answer-item.answer_cell_00X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\
													<option value="">Please choose...</option>\
													<option value="1">Employed full time</option>\
													<option value="2">Employed part time</option>\
													<option value="3">3</option>\
													<option value="4">4</option>\
													<option value="5">5</option>\
												</select>'); 
 
		// Listeners
		$('.inserted-select', thisQuestion).on('change', function(i) {
			var thisTextInput = $(this).closest('.answer-item').find('input:text');
			if($(this).val() != '') {
				$(thisTextInput).val($.trim($('option:selected', this).text())).trigger('keyup');;
			}
			else {
				$(thisTextInput).val('').trigger('keyup');
			}
		});
 
		// 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...8411.lss
Dateigröße:19 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Anhänge:
Letzte Änderung: 7 Monate 3 Wochen her von tpartner.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
7 Monate 3 Wochen her #183620 von PaulMRFGR
Hi all,

Thanks for your help with this - all really useful stuff. We've managed to get this setup now (thanks particularly to Tony for providing the script for LS2.05)

Thank you.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

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