Put a value in question according an other answer?

Mehr
4 Jahre 1 Monat her #100634 von cratostt
cratostt erstellte das Thema Put a value in question according an other answer?
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

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
4 Jahre 1 Monat her #100643 von w0928
w0928 antwortete auf das Thema: Put a value in question according an other answer?
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.
Folgende Benutzer bedankten sich: cratostt

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
4 Jahre 1 Monat her #100651 von cratostt
cratostt antwortete auf das Thema: Put a value in question according an other answer?
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?

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha