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
  • AdelAli's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159721 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
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 5 months ago #159722 by Joffm
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

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • AdelAli
  • AdelAli's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #159728 by AdelAli
Thank you Joffm.. you solved the problem..

Regards,
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose