Array multi flex numbers Checkbox

Mehr
5 Jahre 10 Monate her #72386 von rafael_ur
rafael_ur erstellte das Thema Array multi flex numbers Checkbox
Hello,
I have a question Array Multi Flex Numbers with Checkbox:

ie:

Google
Yahoo
IE

Speed
Design
Accuray
All (*)
None (*)

Answers All and None are exclusive and if check All or None, answers Speed, Design and Accuray can´t check. How do I do?
Many thank,
Rafael

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her #72411 von Mazi
Mazi antwortete auf das Thema: Array multi flex numbers Checkbox
Currently the only solution to achieve this is using some customized Javascript.

It might be possible using the Expression Manager at version 1.92RC, maybe TMSWhite can tell you more about it.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her #72424 von TMSWhite
TMSWhite antwortete auf das Thema: Array multi flex numbers Checkbox
Currently, array_multi_flexi supports one exclusive option, not two. I'll take a look and see if that is feasible.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her #72432 von TMSWhite
TMSWhite antwortete auf das Thema: Array multi flex numbers Checkbox
I misspoke.

"exclude_all_others" is only available for the Mulltiple Choice question types. It is implemented (in 1.92 and beyond) as sub-question-level relevance - so if you pick the exclusive option, the others disappear. Currently, there can only be one exclusive option, not two. However, supporting two could be nice.

The same logic could be used for array-style questions, but we'd need to add a 4th level of relevance checking. Currently, we check at the group, question, and array row (sub-question) level. To support multi-flexi, we'd need to also check at the individual cell level. This is probably do-able, but would take some work.

Please submit these two ideas to ideas.limesurvey.org so they can be considered for inclusion in future releases.

/Tom

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her - 5 Jahre 10 Monate her #72434 von tpartner
tpartner antwortete auf das Thema: Array multi flex numbers Checkbox
To do this in 1.91 with JavaScript:

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the array. Replace "QQ" with the array question ID and "NN" with the number of columns that you would like to be exclusive (in your case, 2).

The script adds click events to the answer elements to make the last NN columns exclusive.
<script type="text/javascript" charset="utf-8">
 
 
	$(document).ready(function() {
 
		exclusiveColumns(QQ, NN);
 
		function exclusiveColumns(qID, colNum) {
 
			// Find the number of answer columns
			var cols = $('#question'+qID+' tbody[id^="javatbd"]:first td').length;
 
			// Loop through all rows
			$('#question'+qID+' tbody[id^="javatbd"] tr').each(function(i) {
				// Loop through all answer cells and add some classes to define exclusive options
				$('td', this).each(function(i) {
					if(i < (cols - colNum)) {
						$(this).addClass('nonExclusiveOpt');
					} 
					else {
						$(this).addClass('exclusiveOpt');
					}
 
				});
 
			});
 
			// Click events on exclusive options
			$('.exclusiveOpt input[type="checkbox"]').click(function(event){
 
				var row = $(this).parents('tr:eq(0)');
 
				if($(this).attr('checked') == true) {
					$('input[type="checkbox"]', row).attr('checked', false);
					$(this).attr('checked', true);
				}
			});
			$('.exclusiveOpt').click(function(event){
 
				var cell = $(this);
				var row = $(this).parents('tr:eq(0)');
 
				// A small delay to allow the checkbox to be checked
				setTimeout(function() {
 
					if($('input[type="checkbox"]', cell).attr('checked') == true) {
						$('input[type="checkbox"]', row).attr('checked', false);
						$('input[type="checkbox"]', cell).attr('checked', true);
					}
 
				}, 250); 
			});
 
			// Click events on non-exclusive options
			$('.nonExclusiveOpt input[type="checkbox"]').click(function(event){
 
				var row = $(this).parents('tr:eq(0)');
 
				if($(this).attr('checked') == true) {
					$('.exclusiveOpt input[type="checkbox"]', row).attr('checked', false);
				}
			});
			$('.nonExclusiveOpt').click(function(event){
 
				var cell = $(this);
				var row = $(this).parents('tr:eq(0)');
 
				// A small delay to allow the checkbox to be checked
				setTimeout(function() {
 
					if($('input[type="checkbox"]', cell).attr('checked') == true) {
						$('.exclusiveOpt input[type="checkbox"]', row).attr('checked', false);
					}
 
				}, 250); 
			});
		}
	});
 
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Letzte Änderung: 5 Jahre 10 Monate her von tpartner.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her #72442 von rafael_ur
rafael_ur antwortete auf das Thema: Array multi flex numbers Checkbox
Hello Tony,

It works perfectly.

Many thanks,

Rafael

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
5 Jahre 10 Monate her #72445 von tpartner
tpartner antwortete auf das Thema: Array multi flex numbers Checkbox
You're welcome Rafael.

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

Bitte Anmelden 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