Quantcast
Channel: Topics in Category: Can I do this with LimeSurvey? - LimeSurvey forums
Viewing all articles
Browse latest Browse all 17529

Limits of Surveychaining - by: tpartner

$
0
0

If you could provide me with a script example of how to insert the names of the actors into the hidden multi-short-text question...


1) Insert a multiple short text question directly after the multiple choice question. The multiple short text needs to have the same number of sub-questions as the maximum answers allowed in the multiple choice question.

2) Give the multiple short text question a class "hidden".

3) Add this script to the text of the multiple choice question:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
 
		// Identify the questions
		var thisQuestion = $('#question{QID}');
		var hiddenQuestion = $(thisQuestion).nextAll('.multiple-short-txt:eq(0)');
 
		// Interrupt the "Next" function
		$('#movenextbtn, #movesubmitbtn').on('click', function(e) {
			// Load the hidden question
			$('input[type="checkbox"]:checked', thisQuestion).each(function(i) {
				var thisText = $.trim($(this).nextAll('.label-text:eq(0)').text());
				$('input[type="text"]:eq('+i+')', hiddenQuestion).val(thisText);
			});
		});
	});
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey_survey_748898_2017-08-23.lss
File Size: 21 KB

Viewing all articles
Browse latest Browse all 17529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>