Validation Equation Only if question is answered

More
1 month 4 days ago #159721 by AdelAli
AdelAli created the topic: Validation Equation Only if question is answered
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

Please Log in to join the conversation.

More
1 month 4 days ago #159722 by Joffm
Joffm replied the 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

Please Log in to join the conversation.

More
1 month 4 days ago #159728 by AdelAli
AdelAli replied the topic: Validation Equation Only if question is answered
Thank you Joffm.. you solved the problem..

Regards,

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!