- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Merge dropdown and input numerical values - low code
- julianna_tri
- Topic Author
- Offline
- New Member
Your LimeSurvey version: Versão 3.28.30+220927
Own server or LimeSurvey hosting: limesurvey.funai.gov.br/index.php?r=admin/survey/sa/listsurveys
Survey theme/template:
==================
hello, I don't know javascript and I need to merge input numerical and dropdown list at the same question.
My goal is numerical input at x1, x3, x5 and x7 also having dropdown list around ten options. I do nee the sum of x1, x3, x5 and x7 values.
Can someone help me?
thanks a lot.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12943
- Thank you received: 3979
there are really many, many examples here how to do this.
Like this. In the provided sample survey you find several examples
[url] forums.limesurvey.org/forum/can-i-do-thi...a-array-texts#189538 [/url]
Now, doing it like this you have to validate that there are no double "Elementos de despesa"
So in my opinion it is better to split the question
1. "multiple" question to select the elements
2. Either "multiple numerical input" or "array(text)" to enter the valores, using the array filter to only display the selected elementos
Here both options. In the array you have the built-in option to show the sum.
The question is: What for do you need the sum?
Only to display it?
Or to use in in following questions to compare or limit some inputs?
Anyway: Use ExpressionManager to sum your values.
And you should send a lss export of these questions, that we can imagine better, what you want to achieve.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- julianna_tri
- Topic Author
- Offline
- New Member
- Posts: 4
- Thank you received: 0
I really need both .
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12943
- Thank you received: 3979
at first
If we write
we mean: Copy the survey, remove everything not related to your problem, send this as lss export.And you should send a lss export of these questions,
We do not want to go through hundreds of questions to find the place of your problem.
Second:
I do not understand what is so difficult to adapt the script of question Q1a in the sample survey.
This contains everything you would like to have.
You see this in the script (the only part you have to adapt)
// Insert selects $('.answer-item.answer_cell_X001', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Yes/No...</option>\ <option value="1">Yes</option>\ <option value="2">No</option>\ </select>'); $('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Select...</option>\ <option value="1">Option 1</option>\ <option value="2">Option 2</option>\ <option value="3">Option 3</option>\ <option value="4">Option 4</option>\ </select>');
You can imagine that X001 and X004 refer to the y-axis subquestion codes - as you see in the screenshot.
So just enter
$('.answer-item.answer_cell_X1', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">- please, select -</option>\ <option value="1">Elemento 1</option>\ <option value="2">Elemento 2</option>\ <option value="3">Elemento 3</option>\ <option value="4">Elemento 4</option>\ <option value="5">Elemento 5</option>\ <option value="6">Elemento 6</option>\ </select>');
for all cells X1, X3, X5 and X7
And as you see you run out of space.
So you could additionally set different column widths
with a second script and some css
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Add a question class thisQuestion.addClass('custom-array'); // Column-specific classes $('table.subquestion-list tr', thisQuestion).each(function(i) { $('th, td', this).each(function(i) { $(this).addClass('column-'+i); }); }); }); </script> <style type="text/css">.custom-array table.subquestion-list col { width: auto !important; } .custom-array table.subquestion-list thead .column-0 { width: 12%; } .custom-array table.subquestion-list thead .column-1 { width: 14%; } .custom-array table.subquestion-list thead .column-2 { width: 8%; } .custom-array table.subquestion-list thead .column-3 { width: 14%; } .custom-array table.subquestion-list thead .column-4 { width: 8%; } .custom-array table.subquestion-list thead .column-5 { width: 14%; } .custom-array table.subquestion-list thead .column-6 { width: 8%; } .custom-array table.subquestion-list thead .column-7 { width: 14%; } .custom-array table.subquestion-list thead .column-8 { width: 8%; } </style>
which would result in
Well, as it is not necessary that all 4 elements have to be chosen, you have to validate that
there are not double elements
there is an input in "valor" if an element is selected and viceversa no input in valor if the element is not selected.
Therefore in my opinion the other solution is better.
Really easy to display the sum (you still did not explain what for you need it)
No check for doubles.
No check for "Both values (elemento & valor) have to be answered.
No javascript.
To finish
Not as long as you use this "outdated" condition builder.Would you know how to set a "group question" condition ??What about a "couple question condition"?
Use ExpressionManager. Much easier, mightier and more flexible.
This condition builder was implemented long before Expression Manager was implemented, about version 1.92.
With Condition Builder you only can create simple conditions.
Read the manual here
[url] manual.limesurvey.org/ExpressionScript_-...ons_and_Relevance.3F [/url]
Conditions : Condition Builder
Relevance: ExpressionManager (since version 5.0 called ExpressionScript)
Please, explain better how to set the conditions in your group.
Next:
You see that the display of question G4P2 with 8 columns is totally broken. Use less columns (6).
You imported an already existing group. You see that the question codes of Ativ 02 are a random sequence of characters now.
Meaning: You can't do this (or change all question codes afterwards)
Though each of your activities have 14 questions you shouldn't display the whole group on one page.
It is really cimbersome for the respondent to scroll and scroll.
A rule for online surveys is "One question per page".
You really should revise your layout.
But to repeat:
explain what means:
Does it mean: If one of the questions is not true (what is TRUE) the respondent is screened out?if I have around 14 questions in a group but, at least, 10th, 12th and 14th has to be true.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- julianna_tri
- Topic Author
- Offline
- New Member
- Posts: 4
- Thank you received: 0
Please Log in to join the conversation.
- julianna_tri
- Topic Author
- Offline
- New Member
- Posts: 4
- Thank you received: 0
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12943
- Thank you received: 3979
Not without seeing what you exactly did.
lss export, please.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12943
- Thank you received: 3979
I do not understand this.basically, i have 4 sum values (both numerical input questions) and i need sum them for a 5th result be viewyd by the respondents.
Here you get two solutions,
1. multiple numerical input with two different ways to display the sum.
2. Array(text)
As said before, send the lss export.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.