Association question with drag and drop

More
4 years 9 months ago #85365 by emiliedg
emiliedg created the topic: Association question with drag and drop
Hi everyone !
I'm currently using Limesurvey 1.92 and I was wondering if there is a question type that I could use for an association question with images. I've tried the drag and drop ranking question ( www.limesurvey.org/fr/forum/development/...rag-and-drop-ranking ) but it didn't work.

What I would like to do is to have 5 images and 5 sentences, each image matches with one sentence (with the drag and drop fonction). Do you think I could do this with Limesurvey ?

Thank you very much !

Please Log in to join the conversation.

More
4 years 9 months ago #85535 by DenisChenu
DenisChenu replied the topic: Association question with drag and drop
Hello,

You need : Image + text.

You can use same workaround (maybe with some adaptation) than:
docs.limesurvey.org/tiki-index.php?page=...rsion_1.90_and_newer

And don't use workaround D&D image function but this one:

function dragDropRankAddImages(qID, choiceText, rankText) {
	if(!choiceText) {
		choiceText = $('#question'+qID+' td.label label').text();
	}
	if(!rankText) {
		rankText = $('#question'+qID+' td.output tr:first td:eq(1) strong').text();
	}
    dragDropRank(qID, choiceText, rankText);
	$('.connectedSortable'+qID+' li').each(function(i) {
		// Remove any text in the sortable choice or rank items
		$(this).html('<span class="img-sortable"></span><span class="text-sortable">'+$(this).text()+'</span>');
		// Move the images into the appropriate sortable list item
		var liID = $(this).attr('id');
		var imgContainer = $(this).find(".img-sortable");
		liIDArray = liID.split('_');
		$('#question'+qID+' img#'+liIDArray[1]+'').appendTo(imgContainer); 
	});
	$('#sortable1'+qID+', #sortable2'+qID+'').css('min-height',$('#sortable1'+qID).height()+'px');
}

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now