Welcome to the LimeSurvey Community Forum

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

Expression manager for validation will NOT let participant continue if blank

  • TDynamics
  • TDynamics's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 week ago #134011 by TDynamics
Hello all,

This is kind of a big issue.

After updating to build 160329, I noticed that more than one of my participants ran into the issue where they could not continue the survey because "one or more answers were not answered in a valid manner". After testing I found out that it was due to the question validation equation, which I have used the same one for months and hasn't been an issue yet.

The expression is to make sure that the answer is only a number. Yes, I know that there is a numerical input question type, but the problem is that the group determined the answer needed to be a number after the survey was active.

Validation equation - regexMatch('/^[0-9][0-9]{0,4}$/',QUESTION)
Validation tip - {if(is_empty(QUESTION) or regexMatch('/^[0-9][0-9]{0,4}$/',QUESTION), '','Your answer must be a number.<br />')}

Can anyone tell me if this is an issue with the update? Or if I am just losing my mind?
The topic has been locked.
More
8 years 1 week ago #134012 by jelo
The validation equation currently is only true if a number is entered.
When the field is blank, the validation in NOT true.
The survey can continue when the validation is TRUE.

Your post implies that you expect the question validation to be TRUE when the field is blank, correct?
To me the validation equation is missing the empty check.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • TDynamics
  • TDynamics's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 week ago #134013 by TDynamics
Here is a screenshot from the Expression Manager page from the online manual. From what it says, when the answer is blank, the expression is considered true... At least from my understanding.

manual.limesurvey.org/Expression_Manager
The topic has been locked.
More
8 years 1 week ago #134027 by jelo
What question type is used?
Did check, what happens when you add the empty check to your validation equation?

I have used validation equations with numbers and non-mandatory questions.
I wasn't able to answer these questions with a blank answer.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 week ago - 8 years 1 week ago #134041 by DenisChenu
Hi,

I'm OK with jelo : if the question is not mandatory you need s_empty(QUESTION) or regexMatch('/^[0-9][0-9]{0,4}$/',QUESTION) like you use in tip.

For the manual : read again : it's due to 0 : empty => 0 for number compare, it's not "in general you don't need is_empty" : it'(s for "number comparaison : 0 == empty .

Like in PHP / javascript
Code:
(false == 0)=== true;
(false == "")=== true 
(false == null)=== true 
See php.net/manual/types.comparisons.php

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 1 week ago by DenisChenu. Reason: php.net link
The topic has been locked.
  • TDynamics
  • TDynamics's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 1 week ago #134087 by TDynamics
Thank you. I was hoping that it was a misunderstanding on my part. I appreciate the explanation.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose