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

More
5 years 1 month ago #73464 by sammy
Is add into 'Validation' ? if so, the regular express will display as attach screen? How to hidden it ? Thanks
Attachments:

Please Log in to join the conversation.

More
5 years 1 month ago #73468 by Steve01
Hello,

which LimeSurvey version do you use? LimeSurvey 1.92RC1 or 1.92RC2? We had a discussion at www.limesurvey.org/de/forum/development/...-in-validation-field and it came to the point whhere we discussed if this messages should be hidden. If I'm correct TMSWhite fixed/updated it in LimeSurvey 1.92RC3 (or a few build after this release candidate) so it might be a good idea to update your/install a new LimeSurvey installation.

Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team

Please Log in to join the conversation.

More
5 years 1 month ago #73475 by TMSWhite
In 1.92 RC4, we have eliminated the display of the regular expression validation message, since we figure very few people would understand it. Instead, if people want to guide users, they can put a readable tip in the Help message, or in the new em_validation_sq or em_validation_q advanced question options.

Please Log in to join the conversation.

More
5 years 1 month ago #73484 by Mazi

TMSWhite wrote: in the new em_validation_sq or em_validation_q advanced question options.

Do we have some documentation for this already?

Talking about documentation: How about the Google Analytics docs :)


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 1 month ago #73495 by TMSWhite
Basic documentation for em_validation_* is here: docs.limesurvey.org/Advanced+question+se...#em_validation_q_tip

It is also linked to each question supporting it, such as here: docs.limesurvey.org/Question+type+-+Shor...sion_1.92_and_beyond

The Google Analytics documentation is here: docs.limesurvey.org/Global+settings&highlight=analytics#General

It's possible that any/all of those should be expanded, but the core documentation has been available for about a week.

Please Log in to join the conversation.

More
5 years 1 month ago #73515 by Mazi
Great work!


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 1 month ago #73541 by sammy
Thanks your information, I test in 1.92RC3.
Where to input the validation of question input ? Or my setting in incorrect field option of question ?

Please Log in to join the conversation.

More
5 years 1 month ago #73542 by TMSWhite
To add regular expression validation of short text or multiple short text, simply enter the regular expression in the "validation" field (one of the core fields, not one of the advanced question settings). This regular expression will be used to validate the short text input (or each of the multiple short text inputs, if that is the question type you use).

Please Log in to join the conversation.

More
5 years 1 month ago #73564 by Mazi
So the same regex will be applied to all sub-questions? Wouldn't that cause problems if you want to validate an adress field, an email field and a phone number in one question?


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 1 month ago #73577 by TMSWhite
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.

Please Log in to join the conversation.

More
5 years 1 month ago #73581 by Mazi

TMSWhite wrote: 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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 1 month ago #73607 by TMSWhite
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

Please Log in to join the conversation.

More
5 years 1 month ago #73614 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 1 month ago #73620 by Steve01
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

Please Log in to join the conversation.

More
5 years 1 month ago #73640 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.