Welcome to the LimeSurvey Community Forum

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

Count checked answers in multiple choice question in a textfield

  • Ryuniri_44052
  • Ryuniri_44052's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
8 years 10 months ago - 8 years 10 months ago #119648 by Ryuniri_44052
Dear all,

is it possible to count the checked answers to a multiple choice answer in a text-variable somehow?

Something like: "You selected 14 answers" to question above?

More details:
I want to implement this text-variable as a help for the participants while processing the survey. They are forced to choose 15 answers out of 50 answer.options. For me this is very user unfriendly - so I want to show the number of choosen answers above the submit button. Can you help me to find a appropriate solution to this issue?
Last edit: 8 years 10 months ago by Ryuniri_44052.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #119658 by DenisChenu
If the question code are MULTI:

{count(that.MULTI)}

See manual.limesurvey.org/Expression_Manager

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: Ryuniri_44052
The topic has been locked.
  • Ryuniri_44052
  • Ryuniri_44052's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
8 years 10 months ago #119677 by Ryuniri_44052
Thank you DenisChenu,

Works! But is it possible to let this "script" count dynamically each time the participant chosses another item? So, that the participants can always see how many answers need to be checked to fullfill the question requirements.

By now it is a little bit confusing that the system tells the participants, that there is no answer chosen until the participant clicks on "next".

Another possibility can be, that this "calculation" only applies after the participant has submitted, but did not the requirements of the question. I tried it with this code and entered the variable "{count(that.Q1)}" in the help-field:
Code:
.hide-tip .good {display: none;}
.hide-tip .error {display: none;}
.input-error .hide-tip .error {display: block;}

But nothing changed to the tip/help, it always applied.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #119678 by DenisChenu
Hi,

It work in javascript. If it's broken in your system : you have a javascript error. This error can happen too with bad expression manager used.

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 topic has been locked.
  • Ryuniri_44052
  • Ryuniri_44052's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
8 years 10 months ago - 8 years 10 months ago #119687 by Ryuniri_44052
Thank you for your reply!

Yes, I have a javacript error in my template. In another template everything works fine. (unfortunately, I have other problems with array filters in other templates).

Do you know how to detect the jacvascript error?

Here's a link to the test-survey (the broken template with javascript error is chosen).
Last edit: 8 years 10 months ago by Ryuniri_44052.
The topic has been locked.
  • Ryuniri_44052
  • Ryuniri_44052's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
8 years 10 months ago #119695 by Ryuniri_44052
I am struggling concentrated from problem to problem.

I am using a new template now. Everything works perfectly for first question. But the variable you show me "{count(that.q1)}" seems to be not working on questions with an arry filter. At any rate it is not working for my second question.

More info:
Variable for first question "q1": {count(that.q1)}
Variable for first question "q2": {count(that.q2)}

Array filter on question q2: exclude choosen answers on q1 for q2.

Do you have an additional help for me?
The topic has been locked.
  • Ryuniri_44052
  • Ryuniri_44052's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
8 years 10 months ago #119713 by Ryuniri_44052
Dear all,

Sorry, I forgot the promised link:

1. Broken template with Java error:
www.sedlak-partner.com/survey/index.php/319438/lang-en

2. New template (without error, counting-variable for first page):
www.sedlak-partner.com/survey/index.php/977626/lang-en

The second version is fine, but I am searching for a solution to use the same counting-variable also on the following pages to count the chosen answers also for questions with array filter. The array filter "connects" the multiple choice questions on first and second page, respective the following pages.

Can you help me again?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose