Check out the LimeSurvey source code on GitHub!

How to hide previous answer from next select list answers

More
5 years 8 months ago #62187 by combo
Hello. I have 3 questions with same answers on select list.
My problem is i do not wish that it is possible to select all three questions with same answers. They all must be different (you cannot select answer "A" for second question, if you selected "A" already for first question etc).
Any help would be appreciated. It is not necessary to hide previously answered question, aim is that it is not possible to select same answers from select list.

Thank you.

Please Log in to join the conversation.

More
5 years 8 months ago #62190 by DenisChenu
Hello,

You can use Question type : Ranking

It's the easyest way.

If you really want someting different : use some javascript to hide some option:
Workarounds: Manipulating a survey at runtime using Javascript

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).

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #62221 by combo
Thank you
I found the code
var previousQuestionAnswer = "{INSERTANS:1000X1X1}";
var currentQuestionID = "#answer1000X1X1"
 
$(document).ready(function() {  		
	// See if the answer for the previous question matches an answer in the current question
	// (other than 'No Answer')
	// If so, disable it.
	if (previousQuestionAnswer!='No Answer') {
		$(currentQuestionID).children().each(function(index, Element)
		{ 
			if ($(this).attr('text') == previousQuestionAnswer)  
				{ $(this).attr('disabled', true);}
			}    
		);}
}); // End of JQuery ready function
 

I dont know anything about javascript, but do I need to rename those "{INSERTANS:1000X1X1}" and "#answer1000X1X1" to something else. I cant figure what should I type there instead of these. Lets say my answer code is "A1", but renaming these to "{INSERTANS:A1}" and "#answerA1" wont work.
Any help would be appreciated, thank you for finding some time for dumbuser lol.
Last Edit: 5 years 8 months ago by combo.

Please Log in to join the conversation.

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