- Posts: 17
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Multiple numeric
- guyllaume
- Topic Author
- Offline
- New Member
Less
More
9 years 6 months ago #113420
by guyllaume
Multiple numeric was created by guyllaume
Hi,
I want to know if it's possible to assign a different min and max value for each of the numeric entry in multiple numeric entry question ?
Many thanks in advance
I want to know if it's possible to assign a different min and max value for each of the numeric entry in multiple numeric entry question ?
Many thanks in advance
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11681
- Thank you received: 2748
9 years 6 months ago #113423
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Multiple numeric
Not by default. You might be able to do something with Javascript, maybe.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: guyllaume
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
9 years 6 months ago #113429
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 numeric
You could do it with JavaScript but it would be far easier to create several questions and use CSS to make them appear as one.
.
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- guyllaume
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
9 years 6 months ago #113451
by guyllaume
Replied by guyllaume on topic Multiple numeric
I did not think css. But if I use several questions, I can no longer use the Sum.
And about javascript, i do not know very well (as my English).
Thank's for your help.
And about javascript, i do not know very well (as my English).
Thank's for your help.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10115
- Thank you received: 3597
9 years 6 months ago - 9 years 6 months ago #113493
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 numeric
Ah, if you need to use the sum feature, several questions may not be appropriate.
Regarding the JavaScript...
For example, if you have a 4-option question where you want the minimums to be "5, 5, 20, 30" and the maximums to be "50, 50, 70, 100", you could:
1) Set up your survey to use JavaScript .
2) Insert something like this script in the question source. It will add a "max-min-error" class to any input that is out of its allowed max/min values and prevent the survey from advancing until the values are fixed.
3) Add something like this to the end of template.css:
Regarding the JavaScript...
For example, if you have a 4-option question where you want the minimums to be "5, 5, 20, 30" and the maximums to be "50, 50, 70, 100", you could:
1) Set up your survey to use JavaScript .
2) Insert something like this script in the question source. It will add a "max-min-error" class to any input that is out of its allowed max/min values and prevent the survey from advancing until the values are fixed.
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // The variables var minimums = [5, 5, 20, 30]; var maximums = [50, 50, 70, 100]; var errorAlert = 'One or more of the inputs is out of its allowed range. Please re-enter the values'; // Identify this question var thisQuestion = $('#question{QID}'); // Add some attributes to the numeric inputs $('input.text', thisQuestion).each(function(i) { $(this).attr('data-min', minimums[i]); $(this).attr('data-max', maximums[i]); }); // Listeners on the numeric inputs $('input.text', thisQuestion).bind('keyup change', function(event) { if($(this).val() < Number($(this).attr('data-min')) || $(this).val() > Number($(this).attr('data-max'))) { $(this).closest('li.question-item').addClass('max-min-error'); } else { $(this).closest('li.question-item').removeClass('max-min-error'); } }); // Interrupt the Next/Submit function (to test for max/min errors) $('#movenextbtn, #movesubmitbtn').bind('click', function () { if($('li.max-min-error', thisQuestion).length > 0) { alert(errorAlert); return false; } }); }); </script>
3) Add something like this to the end of template.css:
Code:
.max-min-error input { background: pink; border: 1px solid red; }
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 6 months ago by tpartner.
The following user(s) said Thank You: guyllaume
The topic has been locked.
- guyllaume
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
9 years 6 months ago #113495
by guyllaume
Replied by guyllaume on topic Multiple numeric
I'll test your solution next monday.
Thank's a lot, Tpartner, for your help and yours explanations.
Guyllaume
Thank's a lot, Tpartner, for your help and yours explanations.
Guyllaume
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13676
- Thank you received: 2496
9 years 6 months ago #113503
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Multiple numeric
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: guyllaume
The topic has been locked.
- guyllaume
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
9 years 6 months ago #113511
by guyllaume
Replied by guyllaume on topic Multiple numeric
Yes indeed.
It will be a good solution, and simpler than javascript.
Thank you.
It will be a good solution, and simpler than javascript.
Thank you.
The topic has been locked.
- guyllaume
- Topic Author
- Offline
- New Member
Less
More
- Posts: 17
- Thank you received: 0
9 years 6 months ago #113730
by guyllaume
Replied by guyllaume on topic Multiple numeric
I have tested your solution, and it's perfect.
Thank's a lot Tpartner.
Thank's a lot Tpartner.
The topic has been locked.