Mautic Community Forums

Form phone number validation

Hi,



I had added a field to my form and match it to the lead field “Phone”. Then when I tested out the form by simply entering some alphabets in it and submit, it went through and recorded as phone in lead profile. My question - is there a way for me to restrict the Phone field input to numbers?



I know that I can create another custom lead field, assign its datatype to number and use it. But if possible I do not want to do so as creating more fields will make the lead profile to looks confusing.


Hi,

I had added a field to my form and match it to the lead field “Phone”. Then when I tested out the form by simply entering some alphabets in it and submit, it went through and recorded as phone in lead profile. My question - is there a way for me to restrict the Phone field input to numbers?

I know that I can create another custom lead field, assign its datatype to number and use it. But if possible I do not want to do so as creating more fields will make the lead profile to looks confusing.

Hi, I think I’ve answered you this question elsewhere already (one place is enough for the next time). To answer it also here, phone numbers has various formats, they can include spaces and special characters. Even letters. Validation of such field is not as easy as “allow just numbers”. For example this phone number: +420 (111) 222 333 would be considered as invalid even though it could be valid in some countries.