- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
add the condition to the answer
- vampire6911
- Topic Author
- Offline
- New Member
Less
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
please help me
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12977
- Thank you received: 3991
3 years 3 months ago - 3 years 3 months ago #210052
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12977
- Thank you received: 3991
3 years 3 months ago #210893
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
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.