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 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.
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.
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 .
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.
Last edit: 9 years 2 weeks ago by DenisChenu. Reason: php.net link