Whole question validation equation (em_validation_q)

More
7 months 1 week ago - 7 months 1 week ago #149929 by sekijr
sekijr created the topic: Whole question validation equation (em_validation_q)
I'm trying to follow this manual And here are my validation fields

Sub-question validation equation:
(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:
{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 months 1 week ago by sekijr.

Please Log in to join the conversation.

More
7 months 1 week ago #149932 by jelo
jelo replied the topic: Whole question validation equation (em_validation_q)
"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?

Please Log in to join the conversation.

More
7 months 1 week ago #149934 by sekijr
sekijr replied the topic: Whole question validation equation (em_validation_q)
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.

Please Log in to join the conversation.

More
7 months 1 week ago #149936 by jelo
jelo replied the topic: Whole question validation equation (em_validation_q)

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.

Please Log in to join the conversation.

More
7 months 1 week ago #149937 by sekijr
sekijr replied the topic: Whole question validation equation (em_validation_q)
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
Attachments:

Please Log in to join the conversation.

More
7 months 1 week ago #149938 by holch
holch replied the topic: Whole question validation equation (em_validation_q)
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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: sekijr

Please Log in to join the conversation.

More
7 months 1 week ago #149939 by sekijr
sekijr replied the topic: Whole question validation equation (em_validation_q)
I apologize for my ignorance then

Please Log in to join the conversation.

More
7 months 1 week ago #149943 by jelo
jelo replied the topic: Whole question validation equation (em_validation_q)
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)
(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))

Please Log in to join the conversation.

More
7 months 1 week ago #149998 by sekijr
sekijr replied the topic: Whole question validation equation (em_validation_q)
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.

Please Log in to join the conversation.

More
7 months 1 week ago #150006 by jelo
jelo replied the topic: Whole question validation equation (em_validation_q)
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.

Please Log in to join the conversation.

More
7 months 1 week ago #150069 by DenisChenu
DenisChenu replied the topic: Whole question validation equation (em_validation_q)
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now