- Posts: 13648
- Thank you received: 2491
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
- Offline
- LimeSurvey Community Team
Less
More
5 years 2 months ago #180527
by DenisChenu
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.
Replied by DenisChenu on topic Auto tick multiple choice answer based on a previous anwer
I'm unsure , but i need a complet lss showing exact issue.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)
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
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
5 years 2 months ago #180560
by tpartner
Here is a basic survey. The question value assignment does not work going forwards but does work going backwards.
Survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Auto tick multiple choice answer based on a previous anwer
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:
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
5 years 2 months ago - 5 years 2 months ago #180561
by DenisChenu
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.
Replied by DenisChenu on topic Auto tick multiple choice answer based on a previous anwer
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»
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»
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.
Attachments:
Last edit: 5 years 2 months ago by DenisChenu. Reason: PS
The topic has been locked.
- tpartner
- Online
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3595
5 years 2 months ago #180566
by tpartner
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.
Replied by tpartner on topic Auto tick multiple choice answer based on a previous anwer
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
5 years 2 months ago #180572
by DenisChenu
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.
Replied by DenisChenu on topic Auto tick multiple choice answer based on a previous anwer
No,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.
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
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 32
- Thank you received: 0
5 years 2 months ago #180631
by develnick
- Nick
Replied by develnick on topic Auto tick multiple choice answer based on a previous anwer
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?
Example:
G1Q1
> A
> B
> C
...
Z
G2Q1
> A
> B
> C
...
> Z
Thanks!
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.