Phone entry format validation

Jason,

Create a new Feature Request to add a mask (e.g. ###-###-####) or character filter (e.g. 1-9) to phone entry, email entry and text entry columns for validation purposes so the Community can vote on it.

1 Like

If only it was that simple

I kind of like the ability to enter numbers and text (to indicate cell, home, work, etc.). On Android, at least, the phone component will easily ignore any text and only work with the numbers, so it’s helpful for adding additional info, such as additional descriptors, or extensions (with a comma to add a pause).


On IOS you can create custom labels for phone numbers. So same, but different…

But my point is that phone number validation is a bit of a slippery slope, and not as simple as the OP seems to think it is. To start with, his criteria of “digits only, fixed length of 10 digits” would exclude precisely 100% of the several hundred (perfectly valid) numbers in my phone book :wink:

Personally, I think phone number validation is a waste of time.

2 Likes

Honestly, I think the Number Entry component would be better with a Min validation value of 1000000000 and a Max validation value of 9999999999 (US number format), but I think it still gets hairy if you start to include dashes.

1 Like

People like to write phone numbers deferent ways… so i would recomend using IF column to check if entry column contains characters that you don’t like in that field and action would be show notification or disable submit button…
Is not hard to do

1 Like

Thank you, all, for your thoughts and suggestions. In response to several replies at once, let me clarify…

The ability to click on a stored phone number and trigger a device to start a call is great, but for now requires the data to be correctly formatted (which to me means manually curating it).

I understand validation is complex, with regex or otherwise, but the issue is more easily solved by most sites nowadays by front-end data input restrictions.
When was the last time you saw a website with a phone number field where you could even possibly enter an invalid number?
I think this is most often done with Javascript, automatically includes parens and dashes, handles US and foreign numbers, and doesn’t require using a mouse click or tab key to jump between sections of the number.

That is the functionality I expected with Glide’s ‘Phone Entry’ field.

I will file a bug/request with Glide mentioning such details.

Thanks, everybody!

4 Likes

Good tip – I agree. That’s the best workaround I have come up with so far. It could at least force a user to put in 10 digit number that doesn’t start with 0 (good for US users only but that’s fine for now).

1 Like

In adicional of what Uzo said, I’d made with a single Template column picking the phone column and adding some replacements:

.
-
+
(
)
space

Everything you replace to blank

This will bring you only numbers

1 Like

We need Regex support in Glide. That would be unreal.

1 Like

Not related but congrats on being made Certified Expert! Totally deserved.

2 Likes

yeah maybe

1 Like

Really? I’ve never seen that. Perhaps my Regex expressions are too simple! :slight_smile:

1 Like

Thanks very much @ThinhDinh - really appreciate that - following your lead :+1:

1 Like

Maybe you don’t do enough greedy matching and backtracking :wink:

congrats as well, btw :+1:

PS. I just have visions of people complaining about their apps running slow and then finding out it’s because of a “simple” regex that they’re using…

....
m<
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
\d]{2}))|[;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?
:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-
fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-
)*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?
:\d+)(?:\.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!
*'(),]|(?:%[a-fA-F\d]{2}))|[?:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'()
,]|(?:%[a-fA-F\d]{2}))|[?:@&=])*))*)(?:;type=[AIDaid])?)?)|(?:news:(?:
(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;/?:&=])+@(?:(?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a-fA-F\d]{2})|[:@&=+])*)(?:/(?:(?:(?:[a-zA-Z\d\$\
-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?))|(?:(?:(?:(?:(?:[a-zA-
Z\d\$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*)(?:/(?:(?:(?:[a-zA-Z\d
\$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?)))
>x;
2 Likes

Tks @Darren_Murphy. Appreciated.

Also there’s a typo in that regex. One of the “[” is missing. I’ll leave it a practice exercise for you to locate it…

2 Likes

In all seriousness though, I hadn’t envisaged using a Regex within a GDE column, but rather as an attribute against a text input field in a form. In the same way that one can currently specify that a text field is required and that it also has length restrictions, one could also specify that it must match a “Regex” mask. In that way I imagine that the matching process would only be executed at the point of checking field constraints prior to submission, so not running “willy nilly out of hand” within the internal DB, if that makes any sense. It would allow so much power in terms of validated data capture in Glide.

The hell is this haha.

1 Like

heh… it’s a regular expression for matching (a subset of) all possible URL’s :joy:

I thought that would have been obvious? :thinking: :stuck_out_tongue:

2 Likes

2 years and still no support for native phone number validation?

Anyway, I managed to get a workaround using regex FWIW: Data entry mask on phone or email component? - #3 by kiptoo