Multiple Choice Question Type - Moving the Other subquestion

Plus d'informations
il y a 3 semaines 6 jours #176862 par krosser
krosser a répondu au sujet : Multiple Choice Question Type - Moving the Other subquestion

tpartner écrit:

I asked Dr. Minke about this and he suggested I post on the forum to see if anyone can help adjust the script.

Did I hear someone call my name? :)

In version 2.54.3, you can use something like this (note, it may not work in future versions if the HTML structure is changed again):

<script type="text/javascript" charset="utf-8">		
 
	$(document).ready(function(){
 
		// New position of the "Other" row (edit as required)
		var newPosition = 3;	
 
		//// NO EDITING REQUIRED BELOW HERE ////
 
		var thisQuestion = $('#question{QID}');
 
		var otherRow = $('.answer-item[id$="other"]', thisQuestion).parent();
		var replaceRow = $('.answer-item:eq('+(newPosition-1)+')', thisQuestion).parent();
 
		$(replaceRow).before($(otherRow));
	});
</script>



Sample survey attached:

Fichier attaché :

Nom du fichier : limesurvey...9(1).lss
Taille du ficher :16 ko



This script does not work in LS 3+. Is there an update for it?

I could manage to move the other modifying the code for a List-radio with other.
<script type='text/javascript' charset='utf-8'>
$(document).ready(function() {
/* Adjust these settings */
 var move_element="other";
 var place_before="SQ003";
/* Please do NOT change the lines below */
var place_before="javatbd{SGQ}"+place_before;
var move_element="javatbd{SGQ}"+move_element;
$("#"+move_element).insertBefore("#"+place_before);
});
</script>

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 5 jours #176948 par tpartner
tpartner a répondu au sujet : Multiple Choice Question Type - Moving the Other subquestion
This will work in 3.x:

<script type="text/javascript" charset="utf-8">		
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// New position of the "Other" row (edit as required)
		var newPosition = 3;	
 
		//// NO EDITING REQUIRED BELOW HERE ////
 
		var thisQuestion = $('#question{QID}');
 
		var otherRow = $('.answer-item[id$="other"]', thisQuestion);
		var replaceRow = $('.answer-item:eq('+(newPosition-1)+')', thisQuestion);
 
		$(replaceRow).before($(otherRow));
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Les utilisateur(s) suivant ont remercié: elissa, krosser

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #177015 par krosser
krosser a répondu au sujet : Multiple Choice Question Type - Moving the Other subquestion

tpartner écrit: This will work in 3.x:

<script type="text/javascript" charset="utf-8">		
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// New position of the "Other" row (edit as required)
		var newPosition = 3;	
 
		//// NO EDITING REQUIRED BELOW HERE ////
 
		var thisQuestion = $('#question{QID}');
 
		var otherRow = $('.answer-item[id$="other"]', thisQuestion);
		var replaceRow = $('.answer-item:eq('+(newPosition-1)+')', thisQuestion);
 
		$(replaceRow).before($(otherRow));
	});
</script>


Thanks Tony, but it only works for multiple-choice without comments.

I'm using the latest LS 3.15 hosted on LS servers, not installed locally.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #177022 par tpartner
tpartner a répondu au sujet : Multiple Choice Question Type - Moving the Other subquestion
Yes, that's what you depicted.

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

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!