- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Validation Equation Only if question is answered
- AdelAli
- Topic Author
- Offline
- New Member
Less
More
6 years 6 months ago #159721
by AdelAli
Validation Equation Only if question is answered was created by AdelAli
Hello,,
I have a list with comment question (Q1) .. it a mandatory question.. I wrote a validation equation: !is_empty(Q1_comment)
to make the comment mandatory too and it working fine..
the problem is there is a red box around the question from the begining.. which means the validation is running already..
I just want this valiation to be run only if form is submitted or the question is answered (a choice is choosen) successfully
senario:
1. if question is not answerd the mandatory validation will be run, so need to validate the comment too.
2. if question is answered (a choice is choosen).. then check for the comment if its empty show error
3. if question is answered and comment is not empty.. validation pass
I have a list with comment question (Q1) .. it a mandatory question.. I wrote a validation equation: !is_empty(Q1_comment)
to make the comment mandatory too and it working fine..
the problem is there is a red box around the question from the begining.. which means the validation is running already..
I just want this valiation to be run only if form is submitted or the question is answered (a choice is choosen) successfully
senario:
1. if question is not answerd the mandatory validation will be run, so need to validate the comment too.
2. if question is answered (a choice is choosen).. then check for the comment if its empty show error
3. if question is answered and comment is not empty.. validation pass
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
6 years 6 months ago #159722
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Validation Equation Only if question is answered
Hello,
Of course you see the red box. You check just for "!is_empty(Q1_Comment)".
Because it is empty the warning is shown.
But you see it in your second scenario:
If question is answered -> comment must not be empty.
And for the question validation at the start also "both empty" must be okay.
(!is_empty(Q1) AND !is_empty(Q1_comment)) OR
(is_empty(Q1) AND is_empty(Q1_comment))
Best regards
Joffm
Of course you see the red box. You check just for "!is_empty(Q1_Comment)".
Because it is empty the warning is shown.
But you see it in your second scenario:
If question is answered -> comment must not be empty.
And for the question validation at the start also "both empty" must be okay.
(!is_empty(Q1) AND !is_empty(Q1_comment)) OR
(is_empty(Q1) AND is_empty(Q1_comment))
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- AdelAli
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
6 years 6 months ago #159728
by AdelAli
Replied by AdelAli on topic Validation Equation Only if question is answered
Thank you Joffm.. you solved the problem..
Regards,
Regards,
The topic has been locked.