Welcome to the LimeSurvey Community Forum

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

Email validation help text

  • Volvic
  • Volvic's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 7 months ago #230200 by Volvic
Email validation help text was created by Volvic
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.3.22
Own server or LimeSurvey hosting: Lime survey hosting
Survey theme/template: Fruity
==================
Good afternoon, 

In the following question I have entered a validation input to sort of filter invalid email addresses (far from perfection I know). The code I entered in the validation is the following; /^(((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*(\r\n)?\n?)+)*)$/. In any case, right now if the typing is missing characters such as @ then the help text is highlighted. I would like to simply change the current text "Please check the format of your answer" to "Please enter a valid email address". I want to keep the question non-mandatory as it is right now, so people can simply skip the question if empty and/or non properly answered.

I have tried some other codes but they simply overlap. 



 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #230202 by Joffm
Replied by Joffm on topic Email validation help text

so people can simply skip the question if empty and/or non properly answered.

This contradicts the validation. Why do a validation if the respondent is free to enter something wrong?

To enter your own text, use the "question validation equation" and the "question validation tip" in "Logic"
Here you have to use "regexMatch(pattern,question)"

And here you can allow to proceed if left empty
Like:
is_empty(question) or regexMatch(pattern,question)

If you only want to give a hint if the email is not correct without any consequences, insert it either in your question text or in the help text.
Like
{if(!regexMatch(pattern,question),'<span style="color:red">This email is not correct</span>','')}
or something like that.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 years 7 months ago #230204 by polbarbe95
Replied by polbarbe95 on topic Email validation help text
Many thanks Joffm, 

I would like to simply give a warning, without consequences. Right now, with the validation equation, the respondent gets a warning but he/she can continue. In your equation, should I include the validation code in "pattern" and the Question number replacing "querstion"?

{if(!regexMatch(pattern,question),'<span style="color:red">This email is not correct</span>','')}
or something like that.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #230205 by Joffm
Replied by Joffm on topic Email validation help text
Search the forum for "regexMatch" examples

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
2 years 7 months ago #230208 by tammo
Replied by tammo on topic Email validation help text
As I understand, there is no good Regex that covers all cases.

I always ask for the email twice. That helps in my surveys, because people will look again. But there are always people that enter valid but incorrect email adresses....

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose