Freeze one from the Multiple Options answers

More
4 years 1 month ago - 4 years 1 month ago #99748 by mimi
mimi created the topic: Freeze one from the Multiple Options answers
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: 4 years 1 month ago by mimi. Reason: missed something

Please Log in to join the conversation.

More
4 years 1 month ago - 4 years 1 month ago #99759 by tpartner
tpartner replied the topic: Freeze one from the Multiple Options answers
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: 4 years 1 month ago by tpartner.
The following user(s) said Thank You: mimi

Please Log in to join the conversation.

More
4 years 1 month ago #99773 by mimi
mimi replied the topic: Freeze one from the Multiple Options answers
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
4 years 1 month ago #99776 by tpartner
tpartner replied the topic: Freeze one from the Multiple Options answers

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.

Start now!

Just create your account and start using Limesurvey today.

Register now