- Posts: 10
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Help: Limit number of selectable answers for multiple choice question
- AnneJasmin
- Topic Author
- Offline
- New Member
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11660
- Thank you received: 2742
What could be the reason? Am I missing something?I
I don't know, maybe the outdated version of LS 3.x that you are using? It hasn't seen an update, bug or secuirty fix since 29/01/2020, so almost 2 years now.
the participants can still choose more than 5 questions.
So when you click on "next" there is no error message? The respondent can just move on? Is the question mandatory?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- AnneJasmin
- Topic Author
- Offline
- New Member
- Posts: 10
- Thank you received: 0
The participants get no error Message, they can just move on. The question is not mandatory. Should it be mandatory?
Thank you for the fast reply!
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11660
- Thank you received: 2742
"One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid."
So yes, you CAN choose more than 5 answer options, but it LS should not let you move on (no matter if the question is mandatory or not, I just tested this).
So please send us a LSS export with just this question so we can have a look at what you have done and if it works on our installation.
Tested with LS 3.28.24+220816.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- AnneJasmin
- Topic Author
- Offline
- New Member
- Posts: 10
- Thank you received: 0
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
- Posts: 10109
- Thank you received: 3595
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ // Number of allowed answers var answers = 5; // Identify this question var thisQuestion = $('#question{QID}'); // Listener on checkboxes $('.answer-item :checkbox', thisQuestion).on('change', function(e) { $('.answer-item :checkbox', thisQuestion).prop('disabled', false); if($('.answer-item :checkbox:checked', thisQuestion).length >= answers) { $('.answer-item :checkbox:not(:checked)', thisQuestion).prop('disabled', true); } }); // Initial states if($('.answer-item :checkbox:checked', thisQuestion).length >= answers) { $('.answer-item :checkbox:not(:checked)', thisQuestion).prop('disabled', true); } }); </script>
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11660
- Thank you received: 2742
However I think it will be very confusing for participants because there are other questions as well and it will take some time for them to find out what the error is.
Generally good practice is to have one question per page, or at least only a limited amount of question.
The question with the "error/problem" is highlighted, so they should be able to see this. You might want to highlight it a little bit more to make it stand out and easier to see which question is with an issue.
Or you implement Tpartners Javascript solution, if you can.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- AnneJasmin
- Topic Author
- Offline
- New Member
- Posts: 10
- Thank you received: 0
I also have a problem with an array filter. I used it for a multiple choice question (Q1) which has several answers and one "other" field. The question afterwards (Q2) ist a ranking question and should display all the selected answers from Q1 as options to be ranked. To my surprise I managed to set up the filter but the "other" field is always displayed, even if empty and not even selected.
Do you know what could be the reason?
Please Log in to join the conversation.
- holch
- Offline
- LimeSurvey Community Team
- Posts: 11660
- Thank you received: 2742
Do you know what could be the reason?
Probably the question / answer codes in both questions is not matching for the "other" option.
Send a LSS export with just those two questions (copy your survey, delete all the unnecessary stuff and leave just the relevant questions, export it as LSS and upload it here).
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
- Posts: 12940
- Thank you received: 3979
The usual reason is that you did something wrong.what could be the reason?
But tto see this we need a lss export of these questions
@holch told you already.
Remeber: In the ranking question there is no "Other" option, but the inserted text.
To add something to your 5 options problem.
What is confusing if the participant sees a big red message?I think it will be very confusing for participants because there are other questions as well
But of course you can customize the message with a question validation (count(self)==5)
And then you create a tip like
{if(count(self)<5,"<span style='color:blue; font-weight:bold'>Please, select some more options, we would like to get five</span>",if(count(self)>5,"<span style='color:maroon; font-weight:bold'>Please select only 5 options</span>","<span style='color:green'>Fine, you selected five options"))}
And to the way to display a survey.
We really often recommend to show a survey "group by group", but with only one question in each group.
This way you are very flexible (sometimes you can show two or more short questions on one page, sometimes not)
Joffm
And your array filtrer.
Again as @holch: I Very probably an error with coding.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- AnneJasmin
- Topic Author
- Offline
- New Member
- Posts: 10
- Thank you received: 0
Please find the survey structure attached to this message.
Thanks youAnne
Please Log in to join the conversation.
- AnneJasmin
- Topic Author
- Offline
- New Member
- Posts: 10
- Thank you received: 0
Please Log in to join the conversation.