The LimeSurvey Fund-Raiser 2012 is complete. Thank you for donating a total of 25,000 USD!     List of donors »

Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi
  • Page :
  • 1

SUJET : Changing the value of a previous question

Changing the value of a previous question il y a 5 mois 2 semaines #89382

  • StuartMark0
  • Portrait de StuartMark0
  • Hors ligne
  • Junior Lime
  • Messages : 21
  • Karma: 0
I have currently set up a variable called isvalid which I am setting to 1 by default. When I ask q1, if the respondent answers this with a value of 2 I want this to reset the value of isvalid to 2.

I have set up a separate equation question with the following text in the question field - yet it doesn;t seem to be doing this validation.
{if (q1=='2',isvalid=='2',isvalid=='1')}

JavaScript is enabled and I am using v1.92 build 120909.

I think this is a simple problem to fix but just can't seem to work this out.

Many thanks
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 2 semaines #89410

  • tpartner
  • Portrait de tpartner
  • Hors ligne
  • LimeSurvey Team
  • Messages : 2853
  • Remerciements reçus 423
  • Karma: 243
Is "isvalid" just a JavaScript variable or a question code?
Cheers,
Tony

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 2 semaines #89472

  • StuartMark0
  • Portrait de StuartMark0
  • Hors ligne
  • Junior Lime
  • Messages : 21
  • Karma: 0
“isvalid” is a question. Thanks

Cheers,
Mark.
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 2 semaines #89495

  • tpartner
  • Portrait de tpartner
  • Hors ligne
  • LimeSurvey Team
  • Messages : 2853
  • Remerciements reçus 423
  • Karma: 243
As far as I know, you cannot use an equation question to set the value of another question.

You may need to use JavaScript to do this. (with a listener on q1)
Cheers,
Tony

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 2 semaines #89507

  • DenisChenu
  • Portrait de DenisChenu
  • En ligne
  • Moderator Lime
  • Messages : 4373
  • Remerciements reçus 451
  • Karma: 165
Yep,

Or easy way:
QCODE: isvalid
QTEXT: {if (q1=='2','2','1')}
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 1 semaine #89608

  • StuartMark0
  • Portrait de StuartMark0
  • Hors ligne
  • Junior Lime
  • Messages : 21
  • Karma: 0
Thanks for this - that works fine for one questions.

If I was needing to revalidate the contents of isvalid later on (for instance checking if q5 was 1), how would be the best way to do this?

thanks
Mark
L'administrateur à désactivé l'accès en écriture pour le public.

Re: Changing the value of a previous question il y a 5 mois 1 semaine #89640

  • DenisChenu
  • Portrait de DenisChenu
  • En ligne
  • Moderator Lime
  • Messages : 4373
  • Remerciements reçus 451
  • Karma: 165
2 Equation question:

1st:
QCODE: isavlid1
QTEXT: {if (q1=='2','2','1')}

2nd (or at end)
QCODE: isavlid
QTEXT: {if (q5=='1' and isvalid1=='1','1',isvalid1)}

Think it worked.

Denis
L'administrateur à désactivé l'accès en écriture pour le public.
  • Page :
  • 1
Modérateurs: DenisChenu, ITEd
Temps de génération de la page : 0.216 secondes
Donation Image