Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Displaying Multiple text boxes based on numerical Input

Displaying Multiple text boxes based on numerical Input 11 months 1 week ago #111735

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
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
The administrator has disabled public write access.

Displaying Multiple text boxes based on numerical Input 11 months 1 week ago #111744

  • OMdev
  • OMdev's Avatar
  • Offline
  • Gold Lime
  • Posts: 173
  • Thank you received: 8
  • Karma: 8
Please create a test survey and attached lss export here.
Trivender Singh
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.
The following user(s) said Thank You: kateibe

Displaying Multiple text boxes based on numerical Input 11 months 1 week ago #111769

  • kateibe
  • kateibe's Avatar
  • Offline
  • Junior Lime
  • Posts: 23
  • Karma: 0
Hello,

Thank you for your prompt response. Please see attached a sample survey.

Thank you!

-Kat
Attachments:
The administrator has disabled public write access.

Displaying Multiple text boxes based on numerical Input 3 months 2 days ago #119727

  • akanakshaa
  • akanakshaa's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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
The administrator has disabled public write access.

Displaying Multiple text boxes based on numerical Input 3 months 2 days ago #119729

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1411
  • Thank you received: 332
  • Karma: 91
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...
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.
The following user(s) said Thank You: akanakshaa

Displaying Multiple text boxes based on numerical Input 3 months 2 days ago #119733

  • akanakshaa
  • akanakshaa's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
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 administrator has disabled public write access.

Displaying Multiple text boxes based on numerical Input 3 months 1 day ago #119763

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1411
  • Thank you received: 332
  • Karma: 91
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...
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
Last Edit: 3 months 1 day ago by Ben_V.
The administrator has disabled public write access.
The following user(s) said Thank You: akanakshaa

Displaying Multiple text boxes based on numerical Input 3 months 1 day ago #119776

  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Team
  • Posts: 5026
  • Thank you received: 1038
  • Karma: 433
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.

<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:

File Attachment:

File Name: limesurvey...4TP2.lss
File Size:25 KB
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: Ben_V, akanakshaa

Displaying Multiple text boxes based on numerical Input 3 months 1 day ago #119777

  • Ben_V
  • Ben_V's Avatar
  • Offline
  • Platinum Lime
  • Posts: 1411
  • Thank you received: 332
  • Karma: 91
tpartner wrote:
...you will need to use a variation of this workaround...

The quadrature of the circle...!
Benoît

goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche)
goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar)
goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de...
The administrator has disabled public write access.

Displaying Multiple text boxes based on numerical Input 3 months 1 day ago #119781

  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Team
  • Posts: 5026
  • Thank you received: 1038
  • Karma: 433
I had to Google "quadrature" :)
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.169 seconds