I’m creating a webform that has a phone number field on it. I already have it so the field will not accept a number without dashes. But how do I get the phone number field to automatically apply dashes when a number is entered?
The code for my phone number field looks like this:
‘#title’: ‘What is a number we may contact you at? (Format: xxx-xxx-xxxx)’
‘#pattern_error’: ‘Format: 555-555-5555’
Does anyone know what extra code I could add to it to automatically apply dashes, and where in the code above would I add that extra code? Any advice is appreciated.