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?
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.
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;