Conditions on previous ranking answers not working

More
5 years 1 month ago #80143 by JackChow
JackChow created the topic: Conditions on previous ranking answers not working
Hi,

I'm using Limesurvey 1.92 latest version with questions displayed group by group.

I'm using conditions designer to set conditions. The relevance code is below

((Q_2_2_1.NAOK != "A4" or Q_2_2_1.NAOK != "A5" or Q_2_2_2.NAOK != "A4" or Q_2_2_2.NAOK != "A5"))

It is not working.The previous Q_2_2 is a ranking questions with 10 ranks and at least 1 answer. The condition works only on rank 1 and when there is no Or or AND ex:

((Q_2_2_1.NAOK != "A4"))

Is it a bug ? Is there any other alternative to achieve this ?

Please Log in to join the conversation.

More
5 years 1 month ago #80200 by Mazi
Mazi replied the topic: Conditions on previous ranking answers not working
Try renaming your question code so it contains no underscore ("_") and re-set the condition.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 1 month ago #80216 by JackChow
JackChow replied the topic: Conditions on previous ranking answers not working
Updated question Q_2_2 code to Q22, still same issue

Please Log in to join the conversation.

More
5 years 1 month ago #80234 by Mazi
Mazi replied the topic: Conditions on previous ranking answers not working
Please export and attach your survey for testing.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 1 month ago - 5 years 1 month ago #80245 by JackChow
JackChow replied the topic: Conditions on previous ranking answers not working
limesurvey_survey_36284.lss
Please find attached the survey, the question with problem is Q_2_4.

Similarly please also check whether you are able to replicate the same problem I mentioned here. The problem is in Section 1 drop downs, Q_1_2. I'm using sherpa tempalte , group by group presentation, latest version of LS(updated yesterday using 3 click upgrade)

www.limesurvey.org/en/forum/can-i-do-thi...swer-codes-api#80235

File Attachment:

File Name: limesurvey...6284.zip
File Size:27 KB
Attachments:
Last Edit: 5 years 1 month ago by JackChow.

Please Log in to join the conversation.

More
5 years 1 month ago #80249 by TMSWhite
TMSWhite replied the topic: Conditions on previous ranking answers not working
JackChow-

Here's the root cause of your problem:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Get the stateCode (two first characters of the state)
		var stateCode = ''.substr(0, 2).toUpperCase();
 
		// Loop through all dropdown options and remove those with codes not starting with the stateCode
		$('select[id^="answer"] option').each(function(i){
			if($(this).attr('value')  && $(this).attr('value').substr(0, 2).toUpperCase() != stateCode) {
				$(this).remove();
			}
		});
	});
</script>

It is removing the entries of all of your drop-down lists. If you remove that, all of the drop-downs display fine.

Please Log in to join the conversation.

More
5 years 1 month ago #80250 by JackChow
JackChow replied the topic: Conditions on previous ranking answers not working
Thanks for your reply.

Yes, I know the problem is with javascript placed in question. But I don't want to remove it because I'm using it to filter my dropdown options.

Please Log in to join the conversation.

More
5 years 1 month ago #80251 by TMSWhite
TMSWhite replied the topic: Conditions on previous ranking answers not working
JackChow-

I'd recommend removing that JavaScript entirely, since it is causing the problem. Instead, split the question into 6 parts (one per set of villages), using relevance/conditions to just show the question containing the list of villiages you want to select. So, instead of one large question Q_1_6, you would have questions Q_1_6A - Q_1_6F, and the relevance for each would be like (for Q_1_6E):
I_4=='E5'

Then, use an Equation question type for Q_1_6 to figure out which village was selected:
{implode('',Q_1_6A.NAOK,Q_1_6B.NAOK,Q_1_6C.NAOK,Q_1_6D.NAOK,Q_1_6E.NAOK,Q_1_6F.NAOK)}


Here's a working example of a subset of your survey using that structure. As you can see, you get the correct villiage code, and all of your dropdowns work.

File Attachment:

File Name: limesurvey...4678.lss
File Size:67 KB
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now