+ Start a Discussion
DeveloperSudDeveloperSud 

Is it possible to use lightning:input type="email" for mutiple email address?

Hi All,

I was referring the salesforce documentation for lightning:input type="email" .There it is mentioned When multiple email is used, the email field expects a single email address or a comma-separated list of email addresses. Example, my@domain.com,your@domain.com with or without a space after the comma.Is it possible to use type="email" when there is a need to enter multiple email id.I have tried to enter multiple emails with comma separation but it is giving me error as "You have entered an invalid format.".
Best Answer chosen by DeveloperSud
sachinarorasfsachinarorasf
Hi,

Please use the below code.

Email:-

An input field for entering an email address. The email pattern is automatically validated during the blur event.

<lightning:input type="email" label="Email" name="email" value="abc@domain.com" multiple="true"/>

Valid email addresses include name@domain and name@domain.com. When multiple is used, the email field expects a single email address or a 
comma-separated list of email addresses. For example, my@domain.com,your@domain.com with or without a space after the comma.

Use the below link.
https://developer.salesforce.com/docs/component-library/bundle/lightning:input/documentation

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
www.sachinsf.com

All Answers

AnudeepAnudeep (Salesforce Developers) 
Hi DeveloperSud, 

Looks like a bug to me

Just tried using my@domain.com,your@domain.com as inputs and it is not accepting the input

https://developer.salesforce.com/docs/component-library/bundle/lightning:input/example#lightningcomponentdemo:exampleInputEmail

I used 
<lightning:input type="email" label="Email" name="email" value="abc@domain.com" /> in my component and it is giving the error "You have entered an invalid format" when I input my@domain.com,your@domain.com

Did you try raising a case with Support already? 

Also, came across this workaround: https://dev.to/ijason/allow-multiple-email-addresses-in-a-lightning-input-component-2mfk

It works with type="text"

Anudeep
DeveloperSudDeveloperSud
Thanks for confirming on this Anudeep.
sachinarorasfsachinarorasf
Hi,

Please use the below code.

Email:-

An input field for entering an email address. The email pattern is automatically validated during the blur event.

<lightning:input type="email" label="Email" name="email" value="abc@domain.com" multiple="true"/>

Valid email addresses include name@domain and name@domain.com. When multiple is used, the email field expects a single email address or a 
comma-separated list of email addresses. For example, my@domain.com,your@domain.com with or without a space after the comma.

Use the below link.
https://developer.salesforce.com/docs/component-library/bundle/lightning:input/documentation

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
www.sachinsf.com
This was selected as the best answer
VICKY_SFDCVICKY_SFDC
TRY THIS

 <lightning:input type="email" label="Email"
            pattern=".+@.+.com"
            placeholder="username@yourDomain.com" />
    </lightning:card>


IT WILL WORK IN ANY  ".com" domain

MARK MY ANSWER AS BEST IF ITS HELP YOU