- Posts: 52
- Thank you received: 4
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple numerical input
- flasher44
- Topic Author
- Offline
- Senior Member
Less
More
7 years 6 months ago #141293
by flasher44
Multiple numerical input was created by flasher44
The topic has been locked.
- flasher44
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 52
- Thank you received: 4
7 years 6 months ago #141325
by flasher44
Replied by flasher44 on topic Multiple numerical input
Can this code found be part of the solution ?
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { // Scale to set the default answer on var defaultAnsweredScale = 2; // Column of that scale to set as default answer var defaultAnsweredColumn = 3; // Identify this question var thisQuestion = $('#question{self.qid}'); // Identify the scales and columns $('.answer-item[class^="answer_cell_1"]', thisQuestion).addClass('scale-1-item'); $('.answer-item[class^="answer_cell_2"]', thisQuestion).addClass('scale-2-item'); $('tr.answers-list', thisQuestion).each(function(i) { $('.scale-1-item', this).each(function(i) { $(this).addClass('scale-1-column-'+(i+1)+'-item'); }); $('.scale-2-item', this).each(function(i) { $(this).addClass('scale-2-column-'+(i+1)+'-item'); }); }); // Click the default answers $('tr.answers-list', thisQuestion).each(function(i) { if($('.scale-'+defaultAnsweredScale+'-item input[type="radio"]:checked', this).length == 0) { $('.scale-'+defaultAnsweredScale+'-column-'+defaultAnsweredColumn+'-item input[type="radio"]:last', this).click(); } }); }); </script>
The topic has been locked.
- LouisGac
- Visitor
7 years 6 months ago #141350
by LouisGac
Replied by LouisGac on topic Multiple numerical input
For most question types, you have a menu entry called "default answers"
manual.limesurvey.org/Question_type_-_Li...alues_.28defaults.29
manual.limesurvey.org/Question_type_-_Li...alues_.28defaults.29
The topic has been locked.
- flasher44
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 52
- Thank you received: 4
7 years 6 months ago #141375
by flasher44
I'm using LimeSurvey V2.50, this menu does not exist anymore ..
Replied by flasher44 on topic Multiple numerical input
LouisGac wrote: For most question types, you have a menu entry called "default answers"
manual.limesurvey.org/Question_type_-_Li...alues_.28defaults.29
I'm using LimeSurvey V2.50, this menu does not exist anymore ..
The topic has been locked.
- LouisGac
- Visitor
7 years 6 months ago #141377
by LouisGac
Replied by LouisGac on topic Multiple numerical input
what question type are you trying to fill?
The topic has been locked.
- flasher44
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 52
- Thank you received: 4
7 years 6 months ago #141380
by flasher44
Replied by flasher44 on topic Multiple numerical input
Look at my screen capture above its an "Array number" question type, as you can I have 0 to 10 as possible answer, but I want as default the answer to be 0, without having to choose it, and not "--" the 2 dashes.
Is it clear for you ?
Is it clear for you ?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
7 years 6 months ago #141393
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 Multiple numerical input
There is no default answer setting for that question type.
Add something like this to the question source:
Add something like this to the question source:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify this question var thisQuestion = $('#question{QID}'); // Set default answers var defaultAnswer = 1; $('select.multiflexiselect', thisQuestion). each(function(i) { if($(this).val() == '') { $(this).val(defaultAnswer); $(this).closest('td.question-item').find('input:hidden:first').attr('value', $(this).val()); } }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- flasher44
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 52
- Thank you received: 4
7 years 6 months ago #141403
by flasher44
Replied by flasher44 on topic Multiple numerical input
Thank you so much Tpartner it works perfectly !!!
The topic has been locked.