Auto tick multiple choice answer based on a previous anwer

Plus d'informations
il y a 8 mois 4 semaines #174654 par develnick
I'd like to auto-tick multiple-choice answer based on a previous answer.

For example

Question q1: Select your documents

> Subquestion a: Document A [ ]
> Subquestion b: Document B [ ]
> Subquestion c: Document C [X]

i.e. User selects Document C

Question q2: Select your documents

> Subquestion d: Document D
> Subquestion e: Document E
> Subquestion f: Document C [X]

i.e. User doens't need to select another time Document C, it is auto-selected.

I tried using relevance equation for Subquestion f as it follows:
!q1_c.NAOK

but this code only hide the question.

- Nick

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174657 par holch
The relevance equation is only there for hiding/showing questions.

What you will probably have to do is create a hidden equation type question, check if a subquestion has been checked and then mark it.

Probalby something like this (not tested, and you will of course have to make adaptation to fit for your survey):
{if(q1_c=="Y", q2_f="Y",)

Something like that.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174666 par DenisChenu

holch écrit: Probalby something like this (not tested, and you will of course have to make adaptation to fit for your survey):

{if(q1_c=="Y", q2_f="Y",)

Something like that.

No, it never work.

Asignation must be done like this:
{q2_f=if(q1_c=="Y", "Y","")}

{QuestionToAssign=ValueToSet}

Not in other way :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174670 par holch

No, it never work.


I noticed that. I played around a little, and it did not work.

Thanks for skipping in and proposing the correct way.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174671 par DenisChenu

holch écrit: …

Thanks for skipping in and proposing the correct way.

Thanks to you for all community help you offer gracefully :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174673 par holch
But somehow your solution didn't work for me either.

I assumed it works only if the second question is on a different page, but it didn't.

Do you see any errors?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines - il y a 8 mois 4 semaines #174675 par DenisChenu

holch écrit: …

I assumed it works only if the second question is on a different page, but it didn't.

Yes : assign action is done only with PHP, then when move next /previous

In same page : you can have a look at this old javascript code : demonstration.sondages.pro/676785?lang=fr

survey in french, but code is international ;)

MULTIPLE : updated via js (to trigger filter on FILTER and FILTEREXCLUDE)

MULTIPLE2 : updated via php (to trigger filter on FILTER2 and FILTEREXCLUDE2)

Think the system still work on 3.X.
If PHP system didn't work : it's 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 .
An error happen ? Before make a new topic : remind the Debug mode .
Dernière édition: il y a 8 mois 4 semaines par DenisChenu.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 4 semaines #174677 par develnick
Hi Denis, thank you for your answer.

I'm using Version 3.14.10+180924. I tried your code this way

{q2_f=if(q1_c=="Y", "Y","")}

and I also tried

{q2_f=if(q1_c=="Y", "Y","N")}

However, it didn't work.

I also saw your Demo here demonstration.sondages.pro/676785?lang=fr , however it seems this example is using array questions.

However, in my survey we are using simple multiple choice questions. Maybe that's the issue here.

- Nick

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174682 par tpartner
@develnick, your first equation is correct but the assignment needs to be done in an equation type question, not in a long-text as you have for "G1Q3".

Working sample survey attached:

Fichier attaché :

Nom du fichier : limesurvey...1541.lss
Taille du ficher :20 ko

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Pièces jointes :
Les utilisateur(s) suivant ont remercié: DenisChenu, develnick

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174685 par holch
This was actually my example (thus my error!). I don't know how this could happen. Must have clicked wrong at one point. I even wondered what that stupid box was in the equation question...

I guess I know now. I need the weekend. ;-)

Tried to change it, but it won't change??? Strange. Need to check if this is a bug.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174686 par holch
Works! Thank you Tpartner for highlighting this stupid mistake with the wrong question type. I was looking and looking and looking and didn't see what was wrong with my code. Turns out: Nothing. :-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174753 par develnick
Thanks, your explanation is great.
What about if the user wants to change also the Q1_c answer while choosing Q2_f i.e. one-to-one correspondence? For instance, imagine an user de-tick Q2_f. With your code, Q1_c is still selected.

Maybe I can try

{q1_c=if(q2_f=="Y", "Y","")} but where do I have to put that code?

- Nick

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174760 par tpartner
In an equation question in a group after the q2 group.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174766 par develnick
Ok. And what happens if the user hits the "Previous" button? Is this code executed?

- Nick

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 mois 3 semaines #174780 par tpartner
Yes, it will be executed every time the page is visited. I assumed that with this type of value assignment that you had the Previous button disabled.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!