- Posts: 15
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Detect given answers from a long list, and autostore only selected items
- Bart01
- Topic Author
- Offline
- New Member
Less
More
10 years 3 weeks ago #107732
by Bart01
Detect given answers from a long list, and autostore only selected items was created by Bart01
My first question is Multiple choice question.
Respondent has to choose 1-3 answers from the list of >100 options.
All further questions only apply to the 1-3 answered options.
Of course, I could use an array filter, but further on i would also like to display the 1-3 answered options in colums, or I would like to be able to select 1 (of the 1-3) for a specific question.
So I would like to declare 3 new variables, with the value of the chosen answers.
(2 might be empty, if only 1 is chosen).
So, in short, I like to find the first NAOK, and declare variable {ANSWER1}
Then, search further for 2nd NAOK (if any), and store this in {ANSWER2}, same for {ANSWER3}
Respondent has to choose 1-3 answers from the list of >100 options.
All further questions only apply to the 1-3 answered options.
Of course, I could use an array filter, but further on i would also like to display the 1-3 answered options in colums, or I would like to be able to select 1 (of the 1-3) for a specific question.
So I would like to declare 3 new variables, with the value of the chosen answers.
(2 might be empty, if only 1 is chosen).
So, in short, I like to find the first NAOK, and declare variable {ANSWER1}
Then, search further for 2nd NAOK (if any), and store this in {ANSWER2}, same for {ANSWER3}
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 3 weeks ago #107746
by first
Survey Designer and Programmer
Replied by first on topic Detect given answers from a long list, and autostore only selected items
Please attach a test lss.
Survey Designer and Programmer
The topic has been locked.
- Bart01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
10 years 3 weeks ago #107749
by Bart01
Replied by Bart01 on topic Detect given answers from a long list, and autostore only selected items
Trivender,
there is not a (test) lss, yet.
It is an issue I need to resolve, before I further design my survey
there is not a (test) lss, yet.
It is an issue I need to resolve, before I further design my survey
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 3 weeks ago - 10 years 3 weeks ago #107750
by first
Survey Designer and Programmer
Replied by first on topic Detect given answers from a long list, and autostore only selected items
step1: Create an multiple short text (Q2) question with 3 answer options on the same page.
step2: use jquery to set the labels first 3 checked answers in the text boxes .
setp3: Hide Q2 with jquery.
Hope you got the idea.
step2: use jquery to set the labels first 3 checked answers in the text boxes .
setp3: Hide Q2 with jquery.
Hope you got the idea.
Survey Designer and Programmer
Last edit: 10 years 3 weeks ago by first.
The topic has been locked.
- Bart01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
10 years 3 weeks ago #107752
by Bart01
Replied by Bart01 on topic Detect given answers from a long list, and autostore only selected items
Trivender,
so I do need jquery.
step 1: ok
step 2: do you have a (rough) example which I can further work on?
URL-link pointing to a similar example is fine as well.
step 3: ok.
thx!
Bart
so I do need jquery.
step 1: ok
step 2: do you have a (rough) example which I can further work on?
URL-link pointing to a similar example is fine as well.
step 3: ok.
thx!
Bart
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
10 years 3 weeks ago - 10 years 3 weeks ago #107754
by first
Survey Designer and Programmer
Replied by first on topic Detect given answers from a long list, and autostore only selected items
Try it. Have as many answers inside multiple short text as you want to pick the answer options from multi question.
Survey Designer and Programmer
Last edit: 10 years 3 weeks ago by first.
The topic has been locked.
- Bart01
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
10 years 3 weeks ago #107998
by Bart01
Replied by Bart01 on topic Detect given answers from a long list, and autostore only selected items
trivender,
I was expecting some sort of loop.
Something like I found in the workarounds:
// Loop through multi-opt checkboxes and, if checked, show corresponding column of array
$('#question'+qMultiOpt+' input.checkbox').each(function(i){
if($(this).prop('checked') == true) {
var classArr3 = $(this).attr('id').split('X'+qMultiOpt);
var ansCode3 = classArr3[1];
$('#question'+qArray+' .ans-'+ansCode3+'').show();
But then, if checked, push the corresponding row into a variable, instead of column.
I was expecting some sort of loop.
Something like I found in the workarounds:
// Loop through multi-opt checkboxes and, if checked, show corresponding column of array
$('#question'+qMultiOpt+' input.checkbox').each(function(i){
if($(this).prop('checked') == true) {
var classArr3 = $(this).attr('id').split('X'+qMultiOpt);
var ansCode3 = classArr3[1];
$('#question'+qArray+' .ans-'+ansCode3+'').show();
But then, if checked, push the corresponding row into a variable, instead of column.
The topic has been locked.