Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Auto tick multiple choice answer based on a previous anwer

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #180527 by DenisChenu

tpartner wrote: It seems that the two equations are fighting each other. I could not get it to work, even using simple equations that did not check for previous answers. If you use an equation to conditionally set Q1, you cannot use the value of Q1 in another conditional setting equation on the next page. It seems to return null.

(this might be seen as a bug)

I'm unsure ;) , but i need a complet lss showing exact issue.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #180560 by tpartner

I'm unsure ;) , but i need a complet lss showing exact issue.


Here is a basic survey. The question value assignment does not work going forwards but does work going backwards.



Survey attached:

File Attachment:

File Name: limesurvey...2-15.lss
File Size:24 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago - 5 years 2 months ago #180561 by DenisChenu
Forward :
step1 (validation of current group) : 1st equation do Q1_SQ001= "" because Q1_SQ002 is empty
step2 (validation of next group) : 2nd equation do Q1_SQ002= "" because Q1_SQ001 is empty

Backward:
2nd equation didn't happen (we don't validate current group)
step2 (validation of previous group) : 1st equation do Q1_SQ001=Q1_SQ002 because Q1_SQ002 is empty *

I really think it's not an issue :)
And clearly :
step1 from forward happen

Possible solution : use more group ?

PS : i think usage of isDoneQ1 and isDoneQ2 can do the trick too.
PS2 : see wityh doneQ2 : partial fix. The issue is more «What is the condition to update (or not) Q1»

File Attachment:

File Name: limesurvey...Done.lss
File Size:25 KB

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 2 months ago by DenisChenu. Reason: PS
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #180566 by tpartner
Code:
Forward :
step1 (validation of current group) : 1st equation do Q1_SQ001= "" because Q1_SQ002 is empty

Yes, but that should (I think) happen on page load, not after I manually set Q1. I check the box so Q1_SQ001== "Y" and that should override the equation and let the second equation set Q2.

No?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #180572 by DenisChenu

tpartner wrote: Yes, but that should (I think) happen on page load, not after I manually set Q1. I check the box so Q1_SQ001== "Y" and that should override the equation and let the second equation set Q2.

No,

Equation is done on page load and at page validation (move next) , it's better like this (we have issue some year ago).

If you want not updated : i think you can use isDoneQ1 var to don't update current value.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • develnick
  • develnick's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 2 months ago #180631 by develnick
Thank you very much! It worked!

What happens if I have to bind a lot of questions, instad of copying and pasting the code for each question? Is there a way like that?

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    var checkedState = false;
    if('{<ARRAY_OF_QUESTIONS>}' == 'Y') {
      checkedState = true;
    }
    $('#answer{SGQ}<ARRAY_OF_QUESTIONS>).prop('checked', checkedState).trigger('change');
  });
</script>


Example:

G1Q1
> A
> B
> C
...
Z

G2Q1
> A
> B
> C
...
> Z



Thanks!

- Nick
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose