- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Put a value in question according an other answer?
- cratostt
- Topic Author
- Offline
- New Member
Less
More
10 years 5 months ago #100634
by cratostt
Put a value in question according an other answer? was created by cratostt
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
The topic has been locked.
- w0928
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 2
10 years 5 months ago #100643
by w0928
Replied by w0928 on topic 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:
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.
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:
Code:
<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.
The following user(s) said Thank You: cratostt
The topic has been locked.
- cratostt
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
10 years 5 months ago #100651
by cratostt
Replied by cratostt on topic 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?
Can i do that?
The topic has been locked.