Welcome to the LimeSurvey Community Forum

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

add the condition to the answer

  • vampire6911
  • vampire6911's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210049 by vampire6911
add the condition to the answer was created by vampire6911
I have 1 question with 5 answers, I want anyone to answer number 1 or 2 must add a comment in the comment box (required condition)
please help me
Attachments:
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago - 3 years 3 months ago #210052 by Joffm
Replied by Joffm on topic add the condition to the answer
Hi,
always the best is to activate the survey and have a look at the answer table.
Here you see


The code of the question is stored in "QCode" and the comment in "QCode_comment".

And now you know your validation equation:
Either the code is greater than 2 or it is less than 3 AND the comment is not empty.
is_empty(QCode) OR QCode gt 2 OR (QCode lt 3 AND !is_empty(QCode_comment)
And with a tip it is fine.
Like this
{if(!is_empty(QCode) AND QCode<3 and is_empty(QCode_comment),"You answered "+QCode+"; a comment is mandatory","You may add a comment")}






Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 3 months ago by Joffm.
The topic has been locked.
  • vampire6911
  • vampire6911's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210862 by vampire6911
Replied by vampire6911 on topic add the condition to the answer
can you help me to step by step ?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 months ago #210893 by Joffm
Replied by Joffm on topic add the condition to the answer
Hi,
1st step: Enter this in "question validation equation"
is_empty(QCode) OR QCode gt 2 OR (QCode lt 3 AND !is_empty(QCode_comment)

2nd step (optional): Enter tsomething like this in "question validation tip"
{if(!is_empty(QCode) AND QCode<3 and is_empty(QCode_comment),"You answered "+QCode+"; a comment is mandatory","You may add a comment")}

Replace "QCode" by the Code of your question.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • vampire6911
  • vampire6911's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 months ago #210953 by vampire6911
Replied by vampire6911 on topic add the condition to the answer
done, thank you so much
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose