Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

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

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73581

  • Mazi
  • Portrait de Mazi
  • Hors ligne
  • LimeSurvey Team
  • Messages : 5324
  • Remerciements reçus 293
  • Karma: 248
TMSWhite écrit:
the preg field is question specific, so in the future, we could allow for sub-question-level validation - e.g. a different regex for each sub-question. Right now, that isn't supported. However, it would really only require a new GUI to enter sub-question-level validation (and relevance, since that is also often desired), plus minor changes to EM.
We should really put that on our list (If I remember correctly, you already have such a list?).
Because mostly, users use the multiple short text to ask for address or contact data and it really makes sense to have a validation for each field.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73607

  • TMSWhite
  • Portrait de TMSWhite
  • Hors ligne
  • LimeSurvey Team
  • Messages : 759
  • Remerciements reçus 82
  • Karma: 36
Mazi-

If we were to augment what we can do with sub-questions, I'd propose adding the following options to each sub-question. Using your example of collecting address information as multiple short text:
(1) relevance - since different sub-fields are relevant for different countries
(2) validation - since different field-types have different validation requirements
(a) we might even want conditional validation - if you wanted to have one field for postal code, but validate it differently depending upon the addresses' country.
(3) mandatory - a different set of fields is required for each type of address
(a) we might also want to consider conditional mandatory

Of course, for now, we could simply have different multiple-short-text questions to collect addresses for each country, and use relevance to pick the proper one. However, since many of the JavaScript customizations effectively try to support some of the other features described above, we may want to try to build them in.

/Tom
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73614

  • Mazi
  • Portrait de Mazi
  • Hors ligne
  • LimeSurvey Team
  • Messages : 5324
  • Remerciements reçus 293
  • Karma: 248
This is a good suggestion. I don't know how much effort it takes to implement some of those features based on conditions (2a and 3a of your list) and how we should deal with a possible GUI.
Depending on that effort we should maybe start small and then extend that feature for Limesurvey 2.x?
My list of priorities would read:

1. Relevance/conditions for sub-questions
2. Mandatory setting for sub-questions
3. Validations for sub-questions
4. Conditional mandatory for sub-questions
5. Conditional validation for sub-questions

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73620

  • Steve
  • Portrait de Steve
  • Hors ligne
  • LimeSurvey Team
  • Messages : 494
  • Remerciements reçus 46
  • Karma: 17
Hello,

perhaps we can use a "Show advanced subquestion settings" link like it is used in the "Show advanced settings" in the questions.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73640

  • Mazi
  • Portrait de Mazi
  • Hors ligne
  • LimeSurvey Team
  • Messages : 5324
  • Remerciements reçus 293
  • Karma: 248
From a GUI point of view that is a good suggestion because only some users will use it.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73645

  • sammy
  • Portrait de sammy
  • Hors ligne
  • Junior Lime
  • Messages : 25
  • Karma: 0
May I define/set the validation such as "{TOKEN:ATTRIBUTE_2} ({TOKEN:ATTRIBUTE_1})" ?
If so, give me a step of UI or hints.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73646

  • TMSWhite
  • Portrait de TMSWhite
  • Hors ligne
  • LimeSurvey Team
  • Messages : 759
  • Remerciements reçus 82
  • Karma: 36
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?
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73647

  • sammy
  • Portrait de sammy
  • Hors ligne
  • Junior Lime
  • Messages : 25
  • Karma: 0
Using token attribute to validate individual invited user to input selected range/value.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73648

  • TMSWhite
  • Portrait de TMSWhite
  • Hors ligne
  • LimeSurvey Team
  • Messages : 759
  • Remerciements reçus 82
  • Karma: 36
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.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: How to add regular express validation in short text input field? il y a 2 ans 6 mois #73987

  • sammy
  • Portrait de sammy
  • Hors ligne
  • Junior Lime
  • Messages : 25
  • Karma: 0
Thanks your information.
Where to input/place em_validation_q advanced question option ? please advise.
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.211 secondes
Donation Image