Welcome to the LimeSurvey Community Forum

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

Mandatory comment box with conditional answer

  • techker
  • techker's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago - 3 years 9 months ago #216067 by techker
Hello..

I want make a survey with the mandatory comment depends on the selected answer. I've setting the question (Q1) as mandatory and select the question type as "single choice question --> List with comment". I set the answer just 2 answers, "YES" or" NO". I want the conditions like this :
-. If I choose the answer is "YES", so I must fill the comment box. In the other side, if I choose "NO" answer, the comment box is not activated (I must not fill the comment box)

I have try to input "!is_empty(Q1_comment)" in "question validation equation" field, but I still could fill the comment box when I choose "NO" answer.
Appreciate your help, because it's my first time to use limesurvey.

Thanks..
  .
Last edit: 3 years 9 months ago by techker.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #216072 by Joffm
Hi,
this is not the best type of question to do this.
Here the comment is a comment on the question in general, not further explanations on specific answers.

You ought to use a different design.
1. Your "Yes/No" question
2. A question of type "short/long text" which is only displayed (by relevance equation) if "Yes" was selected.

But, of course, if you stay to your "list(radio) with comment" you have to extend the validation.
What are the conditions?
One of these has to be TRUE.
1. Q1 answered "Yes" and Q1_comment is not empty
2. Q1 answered "No" and Q1_comment is  empty
 
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • techker
  • techker's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #216074 by techker
Replied by techker on topic Mandatory comment box with conditional answer
thank Jeff for your advice..
How to write (command line) the second option of your advice in survey?
1. Q1 answered "Yes" and Q1_comment is not empty
2. Q1 answered "No" and Q1_comment is empty

Can you guide me?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
3 years 9 months ago #216104 by DenisChenu
Replied by DenisChenu on topic Mandatory comment box with conditional answer
!is_empty(Q1_comment) mean ONLY Q1_comment mus not be empty .

Then
(Q1.NAOK == "Y" AND !is_empty(Q1_comment.NAOK))
OR
(Q1.NAOK != "Y")

I let you fix the second line.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • techker
  • techker's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 9 months ago #216148 by techker
Replied by techker on topic Mandatory comment box with conditional answer
Thanks Denis...

it works..
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose