Welcome, Guest
Username: Password: Remember me

TOPIC: Conditional question being displayed before the parent question is answered

Conditional question being displayed before the parent question is answered 2 years 7 months ago #77115

  • dtra
  • dtra's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 16
  • Karma: 0
Hello

We have upgraded from 1.85 to 1.92+ on our test server, and are looking through to make sure everything works as expected. So far most things have had a simple fix, but now looking at some conditional questions we have they are not working at all.

The conditions are there as they were before, but the child question is being displayed on load, and then the condition doesn't work in the positive or the negative (to hide or show the child question). I'm not 100% sure but I have a feeling it's because the javascript is loaded/output after the question.

So we have a bunch of questions (including the conditional questions), then I see in the html
...
<!-- FINISH: question_start.pstpl -->
</td></tr>
                                <!--<tr><td><font size='-1'><i></i></font></td></tr>-->
				<tr>
					<td width="100%" class="answer">
<ul>
 
 
	<li id='javatbd92721X102X595chn12'>
 
 
		<input class="radio" type="radio" value="chn12" name="92721X102X595" id="answer92721X102X595chn12" onclick="if (document.getElementById('answer92721X102X595othertext') != null) document.getElementById('answer92721X102X595othertext').value='';checkconditions(this.value, this.name, this.type)" />
		<label for="answer92721X102X595chn12" class="answertext">some kind of answer...</label>
        	</li>
...
<script type="text/javascript" src="http://example.com/classes/expressions/em_javascript.js"></script>
<script type='text/javascript'>
<!--
var LEMmode='group';
var LEMgid=102;
function ExprMgr_process_relevance_and_tailoring(evt_type,SGQA,type){
if (typeof LEM_initialized == 'undefined') {
LEM_initialized=true;
LEMsetTabIndexes();
...

I don't know if the code that is being used is in there, it seems strange for the javascript to be loaded midway down the page, it's not like that in the previous version. Please let me know if there are more details required. I've tried it in firefox and chrome with the same result, that checkconditions() is calling function ExprMgr_process_relevance_and_tailoring(evt_type,sgqa,type) which is declared after the conditional question is displayed.

David
Last Edit: 2 years 7 months ago by dtra.
The administrator has disabled public write access.

Aw: Conditional question being displayed before the parent question is answered 2 years 7 months ago #77218

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

LimeSurvey 1.92+ now uses the ExpressionManager to handle conditions (the new construct for conditions is called relevance). There might be a problem so in my opinion it's a good idea to open a ticket at the bugtracker and...
  1. Give as much information as possible
  2. Attach your survey. You can mark your ticket "private" so that only the developers will be able to take a look at it.
  3. Provide step-by-step instructions how to reproduce the problem.
  4. If possible/helpful please provide screenshots

Afterwards please post the link to the bugtracker so we can follow the progress.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Re: Conditional question being displayed before the parent question is answered 2 years 7 months ago #77224

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Are you using a custom template? If so, please try it with the default template.

Also, please look at the upgrade hints to see if you might be affected by any of them - especially the "Mathematical comparisons against empty/no responses" section.

If you still have issues, please attach a sample survey to the bug report.
The administrator has disabled public write access.

Re: Conditional question being displayed before the parent question is answered 2 years 7 months ago #77226

  • dtra
  • dtra's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 16
  • Karma: 0
hmm, I just tried with the default template and it worked correctly, I'll have a look at the upgrade hints to see if that helps at all, thanks.

[update] I don't think that it has anything to do with the empty responses thing, the radio buttons have values, and the comparison is for equals not greater than/less than.
Last Edit: 2 years 7 months ago by dtra.
The administrator has disabled public write access.

Re: Conditional question being displayed before the parent question is answered 2 years 7 months ago #77227

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
dtra-

The templates have changed enough since 1.85 that we recommend you pick one of the built-in templates and customize it to your needs, rather than trying to try to upgrade existing 1.85 templates.

That should solve the problem.
The administrator has disabled public write access.

Re: Conditional question being displayed before the parent question is answered 2 years 7 months ago #77228

  • dtra
  • dtra's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 16
  • Karma: 0
hmmm, thanks for the advice, we'll have a look then
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.169 seconds
Donation Image