Regex Data Validation Needed

+1 . Some of these are US standards. Please @Mark do it global or customizable in case it is done. Thanks

1 Like

Right. They are…so RegEx would allow us to define the data validation parameters.

4 Likes

A few issues/questions:

  • Why don’t you use an Email Entry for the email?
  • You couldn’t express “End Date >= Start Date” in a regex.
  • As a start, what if you could attach necessary conditions to add/edit/form screens, such as “Price > 0” and “End Date is later than Start Date”?
1 Like

Yes! The third bullet point is clutch. And for text/number fields: number of characters/digits?

1 Like

Makes sense. “Number of digits” is a bit weird. For numbers you usually want a high and a low limit, whereas for codes, like ZIP codes or state codes, you want an exact number of letters/digits/whatever, or maybe also a min/max number of symbols.

3 Likes

That works for me!

It would be best if we can have the similar feature which Google Form has e.g. some inbuilt data validation plus also custom field to enter custom regex.

1 Like

Just picking up on this thread and some of @Mark comments. I have a great potential customer who I can move from an old .NET solution to Glide very easily, except for one thing. The current solution captures data from users but requires field validation. It kills me that I can’t help them without some fairly basic validation, so just wondering if there were any plans in the pipeline?

@V88 What specific validations do you need?

I would like the following:

  • ability to restrict a negative number
  • ability to set maximum or minimum number counts
  • ability when selecting date to be today or future dates (not previous dates that have passed)
  • zip codes
  • phone numbers
  • time masking inputs (not date just time)
  • ability to prevent “letters” from being entered into “number” fields

HI @Mark thanks for the reply, for this specific customer we would need:

At a minimum:

  • Range for integer number (min - max)
  • Range for decimal number (min - max)
  • Date (future only)

Would be nice:

  • Postal code
  • Phone number
  • Specific format fior a registration number e.g. AAAA33333

It strikes me that the ability to assign a RegExe to a text entry field would probably cover all bases, although I appreciate not very user friendly if you’re not a RegEx person.

Thanks

yes please. regex would allow for epic flexibility. and solve lots of nit picky issues, that i haven’t even encountered yet. one example: i need data validation for phone numbers. sometimes requiring the: the plus symbol and country code ,and others just the local number.

1 Like

Is there any update on this? I have a project in mind but i need data validation to use glideapp for this

What specific type of data validation do you need? We may do something for you with an Experimental Code snippet.

My understand on the (newly release) experimental code column is that is “The experimental code column is not designed for code that performs actions. It should only be used to compute data or call data from other services.”

I dont understand how this can be used for data entry validation: When a user is entering data into a form. I dont want them to submit invalid data. Google Forms has an excellent regex implementation (for as basic as g forms is, the implementation of regex still makes it one of the most powerful forms apps on the market)

My biggest desire to to have data validation for phone numbers, so the send whatsapp message url button will send to a valid phone number. Forcing a + at the beginning of the number is a pretty safe way to insure that I will have the full valid phone number for whatsapp. I work with international numbers, so I cannot add this myself.

There are so many uses above that people have mentioned that would be ideal. Unfortunately, most apps are american centric, so when the develop say a phone number formatting mask, they sometimes forgot that the rest world isnt america and has to deal with things like country codes.

its just honestly better to provide regex so that when the pretty solutions just were developed to meet every case need, regex can come to the rescue.

Can the experimental code column snippet do this?

If you use a custom form and point your input components at user-specific columns, then there is no reason why you couldn’t use this new column type to do on-the-fly data validation. It’s a great use case for this feature, I think.

2 Likes

for example of "Number of Digits"I can tell you that in IL the ID is conssisted of exactly 9 digits.
another exaple is that a mobile phone should have 10 digits but a landline phone should have only 9.

Hi Darren,
Could you please describe this in greater depth. I’ve tried to get it to work and was unsuccessful

I setup the following Test:
Added an Experimental Code Column using this: String length: https://glide-yes-code-string-length.markprobst.repl.co
It successfully counted the string length for phone number column in the table viewer
I added a hint box using the new strength length exp column as the text. It displayed the current string length.
I edited the phone number column → the hint box string length did not update in the edit form
I added an on submit action using the new exp column to throw a sound/notification → glide app will not even process the column. no action resulted, on the if or and else clause.

So how to make this on the fly?

Sounds like you’re still using the native Glide form. As I mentioned, you’d need to use a Custom Form.

Essentially:

  • Your phone number input would be written to a User Specific Column
  • You then use the yes-code column to check the length of the input
  • And then you use that result to control the user flow. There are a few different ways to do that. Personally, I like to keep as much logic as possible in my Glide tables, so I’d do something like:
  • If-then-else column: If length is greater than X then blank, else true (where X is the max allowed length)
  • Then in my custom form, I’d have a submit button with a custom action attached. That action would have two branches:
    • If “if-then-else column” is true, then do the other actions; Add Row, etc
    • Else Show Notification “Input too long” (or whatever)

You can also have warnings that appear that before the Submit button is tapped (and there is an example of that in my custom form demo).

1 Like

J’ai fait un script ce matin dans ce sens.