Phone field format

Hi. I just want to make a suggestion, and maybe you will consider for the next update, as it’s quite small. It may seem fussy. But when I choose the phone number field type, regardless of how the user enters their phone number, it displays the number on the form and on the ‘listing’ page without gaps/white spaces. Even on the form, the example number has gaps, but when the user enters their number the spaces are removed. I can see you’re using ‘trim’ to remove white spaces.

My own experience of running these kind of sites since 2005 is that most users wants gaps in their number, especially after the country code, just for the sake of clarity for the person calling the number. They are difficult to read as one long string of numbers. Even if I look at my contacts on my Samsung phone, numbers are separated with gaps for clarity. If the user enters lets say a French number, it looks like this +33700000000 on the listing page. Look on a phone contacts list or a company website and it should be displayed as +33 7 00 00 00 00. That is much easier to read than the former. It would be nice if users can choose how their number is displayed, rather than forcing all numbers together. There should definitely be a gap after the country code.

It would also be nice to display the country flag on the listing page, and not just submission page.

If this won’t be considered, is there a snippet I can use? I found the one below from another thread, but it only changes the format on the submission form, not the ‘Listing’ page. I don’t want to alter the core files.

		return preg_replace('/(\+1)(\d{3})(\d{3})(\d{4})/', '($2) $3-$4', $value);


Thanks for your suggestion, we’ll consider adding this feature.

Sorry, there’s no simple code snippet for this, it would require a custom implementation.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.