Welcome to the LimeSurvey Community Forum

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

Whole question validation equation (em_validation_q)

  • sekijr
  • sekijr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago - 7 years 1 week ago #149929 by sekijr
I'm trying to follow this manual And here are my validation fields

Sub-question validation equation:
Code:
(is_empty(address_postcode) or regexMatch ('/\b\y\d{2}-\d{3}\b/', address_postcode))
and
(is_empty(address_post)or regexMatch ('/[a-zA-Z0-9]/', address_post))
Sub-question validation tip:
Code:
{if((is_empty(address_postcode) or regexMatch ('/\b\d{2}-\d{3}\b/', address_postcode)),'', 'Postcode is XX-XXX. i.e. 11-995<br />')}
{if((is_empty(address_post)or regexMatch ('/[a-zA-Z0-9]/', address_post)),'', 'Type a proper post name.')}

But it doesn't let me go through. What am I doing wrong?
Last edit: 7 years 1 week ago by sekijr.
The topic has been locked.
More
7 years 1 week ago #149932 by jelo
"Whole question validation equation" like in the subject or "Sub-question validation equation" like in your post?

I would test sections of the equation before putting all parts together.
It could be that you're doing everything correct but LimeSurvey has a bug.
So what version/build of LimeSurvey is used?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • sekijr
  • sekijr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #149934 by sekijr
The latest, jelo. Installed today.
The subject refers to the tutorial/manual's name in the link provided but I am using multiple short text with three sub-questions where two of them are validated by regex

Thank you for your response btw.
The topic has been locked.
More
7 years 1 week ago #149936 by jelo

sekijr wrote: The latest, jelo. Installed today.

You will have to post the version/build. There are different branches and if everybody post today the search function will be useless if you search for certain versions.


You should export a survey with your question with issues. I don't know which place the validation equation is put. That's why I asked about the whole question vs. sub-question validation wording in your post.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • sekijr
  • sekijr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #149937 by sekijr
I am not using any nightly builds or beta builds. I said I am using the latest one which is Version 2.64.0+170307

Survey file attached as requested

File Attachment:

File Name: limesurvey...2717.lss
File Size:18 KB
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 week ago #149938 by holch
Well, and Jelo told you that there are more than one stable branch at the moment (2.6x and 2.6.x) and this is why he is asking.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: sekijr
The topic has been locked.
  • sekijr
  • sekijr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #149939 by sekijr
I apologize for my ignorance then
The topic has been locked.
More
7 years 1 week ago #149943 by jelo
Use the question validation field instead of the subquestion validation.

I'm currently out of time but please try to change the AND into a OR and check if that helps.

Put that into the question validation (advanced settings of question)
Code:
(is_empty(address_postcode) or regexMatch ('/\b\y\d{2}-\d{3}\b/', address_postcode))
or
(is_empty(address_post)or regexMatch ('/[a-zA-Z0-9]/', address_post))

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • sekijr
  • sekijr's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 week ago #149998 by sekijr
I did it as you asked. The tip shows up in green (default theme) and it lets me through even if I type letters in address_postcode field.

Seems that I am doing something wrong or the regex validation is bugged :( I used this feature in the old LimeSurvey 2.2x and it worked like a charm.
The topic has been locked.
More
7 years 6 days ago #150006 by jelo
I would check every regex in a separate equation and via the question options regex field.
E.g. manual.limesurvey.org/Question_type_-_Sh...28preg_validation.29

There are RegEx bugs in LimeSurvey popping up from time to time where certain rules are not working correctly. Sometimes everything is done correctly but LS is buggy.

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
7 years 5 days ago #150069 by DenisChenu
If LS seems buggy : the best is to make a bug report

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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose