+ Start a Discussion
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4 

I need to put a mask on my lightning input field

Hello, 

I need to setup a lightning input data that should has a mask.
When the user digits a cell-phone - it's should be formatted in screen.
(xx) xxx-xxxx
Can anyone help me ?
 
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4
Should be something like thos: 
http://opensource.locaweb.com.br/locawebstyle-v2/manual/formularios/mascaras-forms/
Raj VakatiRaj Vakati
Use this code 

Use pattern to pass the values
 
<lightning:input type="tel" label="Telephone" name="tel" value="343-343-3434" pattern="((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}	"/>

 
Raj VakatiRaj Vakati
Refer this links

https://developer.salesforce.com/docs/component-library/bundle/lightning:input/documentation
Leticia Monteiro Freitas 4Leticia Monteiro Freitas 4
Raj, and if custom a format, like if my user digits a number should be formatted on  a screen in a specific format.
Like: XXX.XXX-XX
Ravichandra sindheRavichandra sindhe

Hi raj vakati,

could you please help me

when i type a word in lightnig input field and come out of it...it should be masked

and when i click on input field ..it should show a word which i typed