Email validation in "form" entry | Experience Community
Skip to main content
Solved

Email validation in "form" entry

  • Jan 14, 2019 8:20 AM UTC
  • 6 replies
  • 879 views

Hi - Sorry if this is elsewhere. I'm getting some respondents emailing me to say that the survey isn't accepting their @gmail email addresses. I'm asking for emails via the "form" format question. Then in the option tabs for the email line, I had selected "Validation: Valid email address". This is an option *within* the question, and I hadn't set any validation on the toolbar on the right (outside the question in the survey builder, if that makes sense). Is there any reason why these settings would prevent particular domain names being accepted? For now I've turned off validation on this line until I find a fix. Thank you :)

Best answer by TomG

You can remove leading and trailing spaces from text input fields using JS: ``` jQuery("#"+this.questionId+" input[type=text],textarea").on('blur', function(e) { this.value = this.value.trim(); }); ```
View original

6 replies

MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Level 5 ●●●●●
  • Jan 14, 2019 9:54 AM UTC
@EmmaAC for example we have not had any issues with certain domains, however, we have had issues if a person copied & pasted their email into the form, an error was shown. It was caused by the fact that when copied, some email addresses included a space before or after the email address.

  • Author
  • Jan 14, 2019 10:29 AM UTC
Aha. Could it be that a similar thing happens with "autocomplete" on smart phones?

MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Level 5 ●●●●●
  • Jan 14, 2019 12:20 PM UTC
Unfortunately, this i don't know, no one has mentioned autocomplete in our case at least

  • Author
  • Jan 14, 2019 12:22 PM UTC
Thank you :) I think I'll leave it unvalidated for now, just in case!

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Jan 14, 2019 2:51 PM UTC
You can remove leading and trailing spaces from text input fields using JS: ``` jQuery("#"+this.questionId+" input[type=text],textarea").on('blur', function(e) { this.value = this.value.trim(); }); ```

MsIreen
Level 5 ●●●●●
Forum|alt.badge.img+23
  • Level 5 ●●●●●
  • Jan 14, 2019 3:14 PM UTC
@TomG oh, this is really good thing to know, i didn't even think about JS