Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Put a value in question according an other answer?

Put a value in question according an other answer? 6 Monate 2 Wochen her #100634

  • cratostt
  • cratostts Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Hi all we as a company are considering to use limesurvey as a standar tool. I have this question, can i if someone answers in Q2=1 the put in Q3 the value 3 and jump the question
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Put a value in question according an other answer? 6 Monate 2 Wochen her #100643

  • w0928
  • w0928s Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 26
  • Dank erhalten: 3
  • Karma: 1
Yes. Your approach will differ slightly depending on whether or not Q2 and Q3 are in the same section.

If Q2 and Q3 are in the same section...
You will need to add javascript to Q2 that triggers whenever the value of the answer control changes.

If Q2 and Q3 are in different sections...
You will need to add a hidden element to Q3 that references the answer to Q2. You can put this at the end of the "Question" for Q3. For example:

<span class="q2_answer" style="display:none;">{Q2.NAOK}</span>

Then you add javascript to Q3 to set the value of its answer based on the answer to Q2 (and optionally disable so the user can't change).

For example:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
    var q2_answer = "undefined";
    if(trim($(".q2_answer").html()) != '') {
      q2_answer = $(".q2_answer").html();
    }
    if(q2_answer == "2"){
        // do something
    }
    else {
        // do something else
    }
  });
</script>

You will probably have to modify that code somewhat but it should give you an idea. The javascript is almost the same for the first scenario but instead of pulling the value from the hidden element you would pull it directly from the answer element for Q2.

Hope this helps. If anyone has a better way of doing it please post it. I'm no expert. Just trying to help someone out in the hopes someone else will do the same for me. Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: cratostt

Put a value in question according an other answer? 6 Monate 1 Woche her #100651

  • cratostt
  • cratostts Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Thank you very much for your time!! Can you also give me a quick advice, if i have a multichoice question and i have 30 products to choose, if i have 3 gategories with products and in each 10 products and i want to continue the survey only if someone picks at least 2 products in one category

Can i do that?
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.179 Sekunden
Donation Image