Phone number input

Hey there

I’m creating a phone number field and I thought it’s super odd that I’m able to add “regular characters” instead of numbers into a phone number field. I tried adding attributes but it just seems to stay a plain text field. Is there a way to have the field accept just numbers?

Cheers

Hi @Laurens :wave:,

That’s right. Currently, the input phone uses the browser’s native functionality, which doesn’t prevent you from typing what you want.

We are currently developing a new input with mask functionalities to force a particular template (phone, email, postal code, IBAN, etc.). This new element should be available towards the end of October.

1 Like

Hello there,

Is there any update on the mask input ?

Or any workaround to check that the input is a valid phone number , for eg +33612121212 ?

Thank you !
Vincent

my workaround for now is to use an input element (short text) and add a flow onchange and add a custom JS operation :

// update this with the input value
let v = context.component.variables['750270a2-a2b9-454e-b198-21312eab5a4f-value'];
v = v.replace(/\D/g, '').slice(0,9);
context.component.variables['750270a2-a2b9-454e-b198-21312eab5a4f-value'] = v;