Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: How to hide previous answer from next select list answers

How to hide previous answer from next select list answers 5 years 2 months ago #62187

  • combo
  • combo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
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.
The administrator has disabled public write access.

How to hide previous answer from next select list answers 5 years 2 months ago #62190

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9305
  • Thank you received: 1330
  • Karma: 386
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 developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

How to hide previous answer from next select list answers 5 years 2 months ago #62221

  • combo
  • combo's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
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 2 months ago by combo.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.195 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form