@tpartner, I need you help!!!the maximum answers per row

Mehr
2 Monate 1 Woche her #180012 von surveySn
COM_KUNENA_MESSAGE_CREATED_NEW
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Define the maximum answers per column
		var maxAnswers = 1;
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Index the array columns
		$('table.subquestion-list tr', thisQuestion).each(function(i) {
			$('> *', this).each(function(i) {
				$(this).attr('data-index', i);
			});
		});
 
		// Listener on the checkboxes
		$('input[type="checkbox"]', thisQuestion).on('change', function(e) {
			var thisIndex = $(this).closest('.answer-item').attr('data-index');
			$('[data-index="'+thisIndex+'"] input[type="checkbox"]', thisQuestion).prop('disabled', false);
 
			// If max reached, disable unchecked inputs in this column
			if($('[data-index="'+thisIndex+'"] input[type="checkbox"]:checked', thisQuestion).length >= maxAnswers) {
				$('[data-index="'+thisIndex+'"] input[type="checkbox"]:not(:checked)', thisQuestion).prop('disabled', true);
			}
		});
	});
</script>

The above is the restricted column.



What about Row?



www.limesurvey.org/community/forums/can-...election-imit#180008
This way, HTTP 500

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

LimeSurvey Partners
Mehr
2 Monate 5 Tage her #180413 von surveySn
COM_KUNENA_MESSAGE_REPLIED_NEW
Has anybody helped me?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 4 Tage her - 2 Monate 4 Tage her #180430 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
Placing this script in the source of an array-numbers-checkboxes question will enforce a maximum of 3 items checked per row.

<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Define the maximum answers per row
		var maxAnswers = 3;
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Listener on the checkboxes
		$('input[type="checkbox"]', thisQuestion).on('change', function(e) {
			var thisRow = $(this).closest('tr');
			$('input[type="checkbox"]', thisRow).prop('disabled', false);
 
			// If max reached, disable unchecked inputs in this row
			if($('input[type="checkbox"]:checked', thisRow).length >= maxAnswers) {
				$('input[type="checkbox"]:not(:checked)', thisRow).prop('disabled', true);
			}
		});
	});	
</script>

Sample survey attached:

Dateianhang:

Dateiname: limesurvey...2-13.lss
Dateigröße:35 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Anhang:
Last edit: 2 Monate 4 Tage her by tpartner.
Folgende Benutzer bedankten sich: surveySn

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
2 Monate 4 Tage her #180431 von surveySn
COM_KUNENA_MESSAGE_REPLIED_NEW
Thank you very much, tpartner.

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