Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

nice warnings in multiple choice

  • Lombego
  • Lombego's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 8 months ago #131418 by Lombego
nice warnings in multiple choice was created by Lombego
Hi,

I have a simple multiple choice question with checkboxes. I want a nice error warning if someone checks more than 3 checkboxes. But the only thing I can do is an ugly JS-Error, when I submit the form.
I looked in "Demo of em_validation_sq" and the last question G2 > Test is almost what I want, except, that it is an Array question. I tried a lot of Question validation equations but nothing worked for my multiple choice question.

So: Is it possible to get that nice and instant warning for multiple choice questions?

Thanks,
Thomas
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 8 months ago #131426 by tpartner
Replied by tpartner on topic nice warnings in multiple choice
You can use something like this in the Question validation tip:
Code:
{if(count(self) > 3, 'Please check a maximum of 3 answers.', '')}

Sample survey attached:

File Attachment:

File Name: limesurvey...-4-5.lss
File Size:16 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Lombego
  • Lombego's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 8 months ago #131430 by Lombego
Replied by Lombego on topic nice warnings in multiple choice
Thank you. It worked.
Just a tiniy problem in your example the text shows up as alert-danger. In my template (almost the same as default) it is alert-info (the same as the question-helptext).
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose