How to add regular express validation in short text input field?

More
5 years 8 months ago #73645 by sammy
sammy replied the topic: How to add regular express validation in short text input field?
May I define/set the validation such as "{TOKEN:ATTRIBUTE_2} ({TOKEN:ATTRIBUTE_1})" ?
If so, give me a step of UI or hints.

Please Log in to join the conversation.

More
5 years 8 months ago #73646 by TMSWhite
TMSWhite replied the topic: How to add regular express validation in short text input field?
The validations don't try to do substitutions like that first, since if they did, they could break regular expression validations that use embedded curly braces.

Can you give an example of why you would want to compose different regex validations using those token attributes?

Please Log in to join the conversation.

More
5 years 8 months ago #73647 by sammy
sammy replied the topic: How to add regular express validation in short text input field?
Using token attribute to validate individual invited user to input selected range/value.

Please Log in to join the conversation.

More
5 years 8 months ago #73648 by TMSWhite
TMSWhite replied the topic: How to add regular express validation in short text input field?
Can you give a specific example? It isn't clear whether you are trying to compose a regular expression from the token attributes, or whether you are using them to specify min/max value ranges.

All of the advanced question attributes are parsed by EM, except for the regular expression validation in the core validation option. So if you want to specify min/max answers, or min/max numerical value, you can use those options.

If you really need to do dynamic regular expression validation, then you could use new the em_validation_q advanced question option. Say your regular expression pattern is composed of two attributes, you could set the em_validation_q equation to:
regexMatch(implode('',TOKEN:ATTRIBUTE_2,TOKEN:ATTRIBUTE_1),this)

where this will end up referring to the current variable name.

Please Log in to join the conversation.

More
5 years 8 months ago #73987 by sammy
sammy replied the topic: How to add regular express validation in short text input field?
Thanks your information.
Where to input/place em_validation_q advanced question option ? please advise.

Please Log in to join the conversation.

More
5 years 8 months ago #73993 by Mazi
Mazi replied the topic: How to add regular express validation in short text input field?

sammy wrote: Thanks your information.
Where to input/place em_validation_q advanced question option ? please advise.

Doesn't the manual tell you where to do that?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 8 months ago #74018 by Steve01
Steve01 replied the topic: How to add regular express validation in short text input field?
Hello,

it is called "Question validation equation" and you can see/change it if you click "Show advanced settings".

It would be nice if you could explain the EM related things in a more understandable way. I may understand what you are talking about because I actively work with it but users not familiar with EM might have problems understanding things like "you could set the em_validation_q equation".

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Please Log in to join the conversation.

More
5 years 2 weeks ago #86186 by Mazi
Mazi replied the topic: How to add regular express validation in short text input field?

vierundzwanzig wrote: Hello,

it is called "Question validation equation" and you can see/change it if you click "Show advanced settings".

It would be nice if you could explain the EM related things in a more understandable way. I may understand what you are talking about because I actively work with it but users not familiar with EM might have problems understanding things like "you could set the em_validation_q equation".

There is an interesting blog post at www.limesurvey-consulting.com which describes different methods of validating email addresses:
" How to validate email addresses at Limesurvey "


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 10 months ago #88627 by setup
setup replied the topic: How to add regular express validation in short text input field?
Hi,
i'm newbiee and a i'm in a similar situation, tried to explain:

after the first login page wich is the token field
i want to ask for a second secure question which is the passport ID 9 characters (TOKEN:ATTRIBUTE_1)

i 've tried two diferents solutions:

1.- conditions: is two make two more questions groups after the passport question, one group says: your response to Passport ID is no good, and the other group is the really questions i wat to make. I've donned it with "conditions". Like: show this question IF token:attribute_1=... But the problems is when the passport ID is wrong and jumps the group question saying "wrong answer", i don't know how to let the user come back for reentry the passport ID

2.- Question validation equation: i put regexMatch(implode('',TOKEN:ATTRIBUTE_1),this) in advanced settings wich seems to work because until 8 character the background of the field is red and in the 8 and 9 character it becomes white. But when i summit "Next" it doesn't work..

any help please? i've tryed a lot of combinations and readed the manuals "Advanced question settings" and "Using regular expressions" a lot of times and didn't get with the solutions

Help in advanced

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now