Radio list labels based on previous answers

More
6 days 3 hours ago #176371 by EdenResident
EdenResident created the topic: Radio list labels based on previous answers
Hello, I'd like to create a survey that works like this.

A1. Please enter the names of the household members (multiple text input)
Person 1: [Textbox]
Person 2: [Textbox]
Person 3: [Textbox]
...

Person 10: [Textbox]


B1. Please select which HH member you would like to interview (Radio list)
  • Name of person 1 entered from A1
  • Name of person 2 entered from A1
  • ...
  • Name of person 10 entered from A1

Please let me know if this is possible. Thanks.

Please Log in or Create an account to join the conversation.

More
5 days 21 hours ago #176382 by jelo
jelo replied the topic: Radio list labels based on previous answers
LimeSurvey is currently lacking answer relevance (multichoice answers are subquestions, which already have sub-question-relevance). You could use a multi-choice question with a answer limit of 1 (which would be the same as a radio button question) instead.

Displaying the entered text in a different question is not the problem.

There might be other workarounds, but the answer-relevance is overdue.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: EdenResident

Please Log in or Create an account to join the conversation.

More
5 days 13 hours ago #176387 by EdenResident
EdenResident replied the topic: Radio list labels based on previous answers
Hi jelo, thanks for the workaround. That works great for me. I have another question if you don't mind.

So after the user selects the member he wants to interview (from the multiple choice), I want to get and store that name. Provided that my variables are coded like this

A1:
PERSON
01 (subquestion)
02
...

B1:
SELECTEDPERSON
01 (subquestion - multiple choice)
02 (subquestion - multiple choice)
..

Then, to get the name of the selected person, I'd assume that the syntax would be like this {PERSON_{SELECTEDPERSON}}

However, the nesting of variables obviously didn't work for me. So, is there like an eval function in Limesurvey?

Please Log in or Create an account to join the conversation.

More
5 days 11 hours ago #176391 by jelo
jelo replied the topic: Radio list labels based on previous answers
Start reading from here:
manual.limesurvey.org/Expression_Manager#Access_to_Variables

Implemented functions in ExpressScript (still called Express_Manager):
manual.limesurvey.org/Expression_Manager#Access_to_Functions

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
5 days 9 hours ago #176394 by tpartner
tpartner replied the topic: Radio list labels based on previous answers
You can use nested IF statements to display the value from the first question. So, given the question and sub-question codes indicated above, something like this (line-breaks inserted for clarity):

{if(!is_empty(SELECTEDPERSON_01), PERSON_01, 
	if(!is_empty(SELECTEDPERSON_02), PERSON_02, 
		if(!is_empty(SELECTEDPERSON_03), PERSON_03, 
			if(!is_empty(SELECTEDPERSON_04), PERSON_04, 
				if(!is_empty(SELECTEDPERSON_05), PERSON_05, '')))))}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: EdenResident

Please Log in or Create an account to join the conversation.

More
5 days 9 hours ago - 5 days 9 hours ago #176395 by tpartner
tpartner replied the topic: Radio list labels based on previous answers
Regarding using a multiple-choice question with maximum answers of 1 to replicate a radio question, you can insert this script in the question source to automatically uncheck other options as options are checked.

<script type="text/javascript" charset="utf-8">
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Listener on the checkboxes
		$('input:checkbox', thisQuestion).on('change', function(e) {
			if($(this).is(':checked')) {
				$('input:checkbox', thisQuestion).not(this).prop('checked', false).trigger('change');
			}
		});
	});
</script>

Here is a small sample survey incorporating both of these concepts:

File Attachment:

File Name: limesurvey...4872.lss
File Size:23 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last Edit: 5 days 9 hours ago by tpartner.
The following user(s) said Thank You: EdenResident

Please Log in or Create an account to join the conversation.

More
5 days 8 hours ago #176402 by jelo
jelo replied the topic: Radio list labels based on previous answers
Tony, since I forgot to ask the thread-starter what LS version is in use, we should add that your nice workaround is for LS 3.X.

That answer-relevance is not available in LS3 and LS4 as well, is a pity (or more).

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: tpartner

Please Log in or Create an account to join the conversation.

More
5 days 6 hours ago #176406 by holch
holch replied the topic: Radio list labels based on previous answers
Answer option relevance now!

;-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
4 days 15 hours ago #176451 by EdenResident
EdenResident replied the topic: Radio list labels based on previous answers
Thanks, tpartner. I was able to do that with nested ifs.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!