- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Displaying Multiple text boxes based on numerical Input
- kateibe
- Topic Author
- Offline
- New Member
Less
More
9 years 8 months ago #111735
by kateibe
Displaying Multiple text boxes based on numerical Input was created by kateibe
Hello,
I have been trying for the past five hours to figure out how I can have a multiple text box question populate based on the numerical answer from a previous question.
For example I want to ask:
Q1: How many sisters do you have? (numeral input from 1-4 or list radio question from 1-4)
One
Two
Three
Four
Q2: Enter the names of your sisters (multiple text boxes). The text boxes will populate based on the total number of sisters. For example if "3" is input into the numerical input question or if "Three" is selected from the list radio question three text boxes will populate.
I have played around with "array filters", "array exclusions" but have not been able to figure it out. Please help!
Regards,
Kat
I have been trying for the past five hours to figure out how I can have a multiple text box question populate based on the numerical answer from a previous question.
For example I want to ask:
Q1: How many sisters do you have? (numeral input from 1-4 or list radio question from 1-4)
One
Two
Three
Four
Q2: Enter the names of your sisters (multiple text boxes). The text boxes will populate based on the total number of sisters. For example if "3" is input into the numerical input question or if "Three" is selected from the list radio question three text boxes will populate.
I have played around with "array filters", "array exclusions" but have not been able to figure it out. Please help!
Regards,
Kat
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
9 years 8 months ago #111744
by first
Survey Designer and Programmer
Replied by first on topic Displaying Multiple text boxes based on numerical Input
Please create a test survey and attached lss export here.
Survey Designer and Programmer
The following user(s) said Thank You: kateibe
The topic has been locked.
- kateibe
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
9 years 8 months ago #111769
by kateibe
Replied by kateibe on topic Displaying Multiple text boxes based on numerical Input
Hello,
Thank you for your prompt response. Please see attached a sample survey.
Thank you!
-Kat
Thank you for your prompt response. Please see attached a sample survey.
Thank you!
-Kat
Attachments:
The topic has been locked.
- akanakshaa
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #119727
by akanakshaa
Replied by akanakshaa on topic Displaying Multiple text boxes based on numerical Input
Hi,
I am also on the same boat. Would like to know how can I display a certain number of text boxes based on previous numerical input. I want to ask a question as to how many countries are you working and then want to get the names of the countries. If somebody said 7 countries, I need to display 7 text boxes. Is it possible?
Many thanks
I am also on the same boat. Would like to know how can I display a certain number of text boxes based on previous numerical input. I want to ask a question as to how many countries are you working and then want to get the names of the countries. If somebody said 7 countries, I need to display 7 text boxes. Is it possible?
Many thanks
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 11 months ago #119729
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Displaying Multiple text boxes based on numerical Input
HI,
You can use conditions or (easier) set correctly the "relevance" field for each question...
If your numerical input question code is "Qcountry",
For your text-box #1 the relevance (= condition) is:
((Qcountry.NAOK >= "1"))
For your text-box #2:
((Qcountry.NAOK >= "2"))
For your text-box #2:
((Qcountry.NAOK >= "3"))
etc..
Have a look a the manual too, because relevance use & conditions are really well explained...
You can use conditions or (easier) set correctly the "relevance" field for each question...
If your numerical input question code is "Qcountry",
For your text-box #1 the relevance (= condition) is:
((Qcountry.NAOK >= "1"))
For your text-box #2:
((Qcountry.NAOK >= "2"))
For your text-box #2:
((Qcountry.NAOK >= "3"))
etc..
Have a look a the manual too, because relevance use & conditions are really well explained...
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: akanakshaa
The topic has been locked.
- akanakshaa
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #119733
by akanakshaa
Replied by akanakshaa on topic Displaying Multiple text boxes based on numerical Input
Thank you Ben. I have already tried that. But I would like to use the question type "Multiple short text". Is it possible? Please see the attached images.
Attachments:
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 11 months ago - 8 years 11 months ago #119763
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Displaying Multiple text boxes based on numerical Input
Oups sorry, I misunderstood your request...
I suppose you want to display those 2 questions on the same page ? (of course it's easier if on separate pages)
I'm pretty sure that this topic was already answered in this forum, but I'm unable to find this discussion
I'll have a look again, if nobody can give you a hand to achieve this...
I suppose you want to display those 2 questions on the same page ? (of course it's easier if on separate pages)
I'm pretty sure that this topic was already answered in this forum, but I'm unable to find this discussion
I'll have a look again, if nobody can give you a hand to achieve this...
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 8 years 11 months ago by Ben_V.
The following user(s) said Thank You: akanakshaa
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
8 years 11 months ago #119776
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Displaying Multiple text boxes based on numerical Input
If you want to use a multiple-short-text in LS 2.05, you will need to use a variation of this workaround -
www.limesurvey.org/en/forum/can-i-do-thi...ious-question#119674
. (2.06 will have sub-question relevance)
1) Insert a multiple-choice after the numeric question
2) Filter the multiple-short-text by the hidden question
3) Add the following script to the source of the numeric question.
Sample survey attached:
1) Insert a multiple-choice after the numeric question
2) Filter the multiple-short-text by the hidden question
3) Add the following script to the source of the numeric question.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Identify the questions var q1 = $('#question{QID}'); var qHidden = q1.nextAll('.multiple-opt:eq(0)'); // Hide qHidden qHidden.hide(); // Listeners on the Q1 input $('input[type="text"]', q1).on('change keyup', function(e, value) { var q1Value = $(this).val(); // Reset the hidden question $('input.checkbox', qHidden).prop('checked', false); $('li.question-item input[type="hidden"]', qHidden).attr('value', ''); // Check the appropriate boxes in qHidden $('li.question-item:lt('+q1Value+') input.checkbox', qHidden).prop('checked', true); $('li.question-item:lt('+q1Value+') input[type="hidden"]', qHidden).attr('value', 'Y'); // Loop through subquestions in qHidden and fire the Expression Manager checkconditions() function $('input.checkbox', qHidden).each(function(i) { checkconditions(this.value, this.name, this.type); }); }); }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: Ben_V, akanakshaa
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 11 months ago #119777
by Ben_V
The quadrature of the circle...!
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Displaying Multiple text boxes based on numerical Input
tpartner wrote: ...you will need to use a variation of this workaround...
The quadrature of the circle...!
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
8 years 11 months ago #119781
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Displaying Multiple text boxes based on numerical Input
I had to Google "quadrature"
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
8 years 11 months ago #119782
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Displaying Multiple text boxes based on numerical Input
better in google.ca if there is some setting options for Quebec...
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11658
- Thank you received: 2742
8 years 11 months ago #119792
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Displaying Multiple text boxes based on numerical Input
Hehehe, I think in English it would be "Squaring the circle".
In German it is quite a well used saying "Quadratur des Kreises", which seems to be exactly the same in French.
In German it is quite a well used saying "Quadratur des Kreises", which seems to be exactly the same in French.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.