Welcome, Guest
Username: Password: Remember me

TOPIC: Conditions on previous ranking answers not working

Conditions on previous ranking answers not working 2 years 5 months ago #80143

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
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 ?
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80200

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80216

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
Updated question Q_2_2 code to Q22, still same issue
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80234

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80245

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
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_survey_36284.zip
File Size: 27 KB
Last Edit: 2 years 5 months ago by JackChow.
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80249

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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.
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80250

  • JackChow
  • JackChow's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Karma: 0
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.
The administrator has disabled public write access.

Re: Conditions on previous ranking answers not working 2 years 5 months ago #80251

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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_survey_74678.lss
File Size: 67 KB
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.283 seconds
Donation Image