Check out the LimeSurvey source code on GitHub!

Freeze one from the Multiple Options answers

More
3 years 4 months ago - 3 years 4 months ago #99748 by mimi
Hi ...

Based on attachment i had given, i would like to make an 'option 1', '2', '3' and '4' are freeze if user checked on 'none of the above' answer.

I already used that script to freeze one of the Multiple Options answers. I refer the script from limesurvey workaround where's the title is 'Partially Randomized Answers - Multiple Options & List (radio) questions'. But now it still not working for me. May i know where's the prob is? am i missed something there or im using the wrong script?


any help would be appreciated. Thank You so Much..


<script type="text/javascript" charset="utf-8">

$(document).ready(function() {

// Function to allow randomization of all answers except the last one in Multiple options and List/radio questions
function partRand(21639, 11, 177) {

// Find the number of answers
var ansCount = ''
$( 'div#question' + 177 + ' td.answer li' ).each(function(i) {
ansCount = (i + 1);
});

// Place the last answer created at the end of the list
$( 'input#answer' + 21639 + 'X' + 11 + 'X' + 177 + ansCount + '' ).parent().appendTo($( '#question' + 177 + ' td.answer ul' ));
}

// Call the function with the SID, GID and QID
partRand(21639, 11, 177);
});

</script>
Attachments:
Last Edit: 3 years 4 months ago by mimi. Reason: missed something

Please Log in to join the conversation.

More
3 years 4 months ago - 3 years 4 months ago #99759 by tpartner
Assuming your answer codes are sequential as depicted below, place this script in the question source:

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
		// Identify this question
		var qID = '{QID}';
		var thisQuestion = $('#question'+qID+'');
 
		// Find the number of answers
		var ansCount = $('.question-item', thisQuestion).length;
 
		// Place the last answer created at the end of the list
		$('.questions-list', thisQuestion).append($('.question-item[id$="X'+qID+ansCount+'"]'));
	});	
</script>



Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 3 years 4 months ago by tpartner.
The following user(s) said Thank You: mimi

Please Log in to join the conversation.

More
3 years 4 months ago #99773 by mimi
Thank You mr.tpartner. it work on randomizing answers. But the last answer still not functioning, which i want the 1st answer till the forth will be hidden automatically/can not be checked if user checked on the last answer.

Thank You again..

Please Log in to join the conversation.

More
3 years 4 months ago #99776 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: mimi

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form