Email field allows spaces | Community
Skip to main content
Answered

Email field allows spaces

  • February 22, 2023
  • 3 replies
  • 272 views

Hello, looks like the email input field allows spaces. For example, “type form@forms.com.” Expected behavior is that the email validation is set off if the user enters spaces inside their email.

Best answer by jeremielp

I agree with cybot. The test should be made when the user is filling the email not at the form submission.

You already have a test that most of the time displays the following error message, but this test is not consistent with the test made by the backend when the form is submitted.
"Hmm... that email doesn't look right"

Waiting for the end of the form to show a broad message that says:
"Sorry, something’s wrong. Refresh the page and try again. We’ll save any info you already entered."
Is unlikely to get the user to figure out that the issue is the email

Your backend does send back a JSON with the correct reason of the form not being submitted, so if you cannot fix the email field check, it would interesting to show a better message to the user.

{"code":"VALIDATION_ERROR","description":"There is a problem with your request","details":[{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0","description":"Must validate \"then\" as \"if\" was valid"},{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0.email","description":"Does not match format 'email'"},{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0","description":"Must validate all the schemas (allOf)"}]}

 

By the way, the issue is not only with spaces, but also double dots, backslashes, quotes...


Invalid Emails considered valid by the email field check but blocked at form submission

email email@example.com
email..email@example.com
this\ is"really"not\allowed@example.com
just"not"right@example.com

Invalid Emails considered valid by the email field check and accepted at form submission

email@-example.com
email@111.222.333.44444

Non ascii chars also get accepted by both checks.

あいうえお@example.com


 

View original

3 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 15008 replies
  • February 22, 2023

Hi @cybot When you try to submit the form, does it let you? When I tested this with a space, this is the error I kept getting until I fixed the space: 

 


Forum|alt.badge.img+5
  • Community Wizard
  • 127 replies
  • Answer
  • February 23, 2023

I agree with cybot. The test should be made when the user is filling the email not at the form submission.

You already have a test that most of the time displays the following error message, but this test is not consistent with the test made by the backend when the form is submitted.
"Hmm... that email doesn't look right"

Waiting for the end of the form to show a broad message that says:
"Sorry, something’s wrong. Refresh the page and try again. We’ll save any info you already entered."
Is unlikely to get the user to figure out that the issue is the email

Your backend does send back a JSON with the correct reason of the form not being submitted, so if you cannot fix the email field check, it would interesting to show a better message to the user.

{"code":"VALIDATION_ERROR","description":"There is a problem with your request","details":[{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0","description":"Must validate \"then\" as \"if\" was valid"},{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0.email","description":"Does not match format 'email'"},{"code":"INVALID_PAYLOAD","in":"body","field":"answers.0","description":"Must validate all the schemas (allOf)"}]}

 

By the way, the issue is not only with spaces, but also double dots, backslashes, quotes...


Invalid Emails considered valid by the email field check but blocked at form submission

email email@example.com
email..email@example.com
this\ is"really"not\allowed@example.com
just"not"right@example.com

Invalid Emails considered valid by the email field check and accepted at form submission

email@-example.com
email@111.222.333.44444

Non ascii chars also get accepted by both checks.

あいうえお@example.com


 


  • Author
  • Explorer
  • 1 reply
  • April 3, 2023

Thank you @jeremielp. That explains the issue perfectly.


Reply