Welcome, Guest
Username: Password: Remember me

TOPIC: Freeze one from the Multiple Options answers

Freeze one from the Multiple Options answers 1 year 11 months ago #99748

  • mimi
  • mimi's Avatar
  • Offline
  • Junior Lime
  • Posts: 32
  • Karma: 0
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: 1 year 11 months ago by mimi. Reason: missed something
The administrator has disabled public write access.

Freeze one from the Multiple Options answers 1 year 11 months ago #99759

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5087
  • Thank you received: 1046
  • Karma: 438
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>


This message has an attachment image.
Please log in or register to see it.

Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 1 year 11 months ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: mimi

Freeze one from the Multiple Options answers 1 year 11 months ago #99773

  • mimi
  • mimi's Avatar
  • Offline
  • Junior Lime
  • Posts: 32
  • Karma: 0
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..
The administrator has disabled public write access.

Freeze one from the Multiple Options answers 1 year 11 months ago #99776

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5087
  • Thank you received: 1046
  • Karma: 438
Exclusive option (exclude_all_others) - manual.limesurvey.org/Question_type_-_Mu...xclude_all_others.29
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: mimi
Moderators: ITEd
Time to create page: 0.146 seconds