function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Adam PodrazaAdam Podraza 

How to add validation to email input lightning component?

Hi all.

We are using an email input component on a screen flow. The email component has some validation but in order to avoid errors we want to add an additional rule.

Today one of our partners was able to post their email as "email@gmail". The validation didn't catch this invalid email. I tried using the component and it catches "email@gmail." or "email@".

How can I add a regular expression or other form of validation to catch an invalid email like "email@gmail"?

Thanks in advance.
sachinarorasfsachinarorasf
Hi Adam,

Please follow the below link:

https://sfdcmonkey.com/2017/04/11/email-validation-lightning-component/
https://salesforcescool.blogspot.com/2018/12/email-field-validation-in-lightning.html
https://developer.salesforce.com/forums/?id=906F000000091SHIAY

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Sachin Arora