- Posts: 18
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
8 years 3 weeks ago #134011
by TDynamics
Expression manager for validation will NOT let participant continue if blank was created 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?
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.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
8 years 3 weeks ago #134012
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Expression manager for validation will NOT let participant continue if blank
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.
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 0
8 years 3 weeks ago #134013
by TDynamics
Replied by TDynamics on topic Expression manager for validation will NOT let participant continue if blank
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
manual.limesurvey.org/Expression_Manager
Attachments:
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
8 years 3 weeks ago #134027
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Expression manager for validation will NOT let participant continue if blank
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.
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
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
8 years 3 weeks ago - 8 years 3 weeks ago #134041
by DenisChenu
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.
Replied by DenisChenu on topic Expression manager for validation will NOT let participant continue if blank
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
See
php.net/manual/types.comparisons.php
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
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 3 weeks ago by DenisChenu. Reason: php.net link
The topic has been locked.
- TDynamics
- Topic Author
- Offline
- New Member
Less
More
- Posts: 18
- Thank you received: 0
8 years 2 weeks ago #134087
by TDynamics
Replied by TDynamics on topic Expression manager for validation will NOT let participant continue if blank
Thank you. I was hoping that it was a misunderstanding on my part. I appreciate the explanation.
The topic has been locked.