OpnForm icon indicating copy to clipboard operation
OpnForm copied to clipboard

Feature request: regexp and other validation on input fields

Open mhphilip opened this issue 3 years ago • 5 comments

I hope you don't mind feature requests. They might make your product better (and of course more usable for myself).

Currently the only possible validation on input fields is whether they are required or not. It would be very useful (albeit somewhat hard to code for regular users) if you could add a regexp pattern to validate a text field and maybe some simple extra validations on number fields.

  • There is a max length, but not a min length of a field
  • For number fields: the "step" size and a max and or min value
  • For text fields being able to set certain restrictions on characters would be convenient, where a regexp pattern would offer the most flexibility (albeit somewhat hard for a novice to implement)

E.g. to test the form builder I'm recreating a "new donor" field for a sample NGO. I run into trouble trying to implement the following:

  • First name field : where I would like a minimum of 2 characters
  • IBAN (bank account number) : where I want a regexp pattern and fixed length
  • Donation amount : where I want a number field, but also a minimum value and a step size of €1

I don't expect you to build these, but you might :)

mhphilip avatar Jan 09 '23 14:01 mhphilip

Good call, I like the regex validation ideas. These are great additions indeed, we'll keep them in mind for the future!

JhumanJ avatar Jan 28 '23 13:01 JhumanJ

@JhumanJ any progress on this? If not, I could take a look at it, seems interesting enough.

Ahtritus avatar Sep 12 '23 10:09 Ahtritus

We don't have short term plans for this, so we didn't setup a bounty, but you're more than welcome to work on this 🙌

JhumanJ avatar Sep 12 '23 10:09 JhumanJ

We really need a validation feature, even if it is simple at first, to validate URLs and for example, emails, so that an email is only valid if it has a point and an @ symbol in the email.

peaklabs-dev avatar Feb 04 '24 18:02 peaklabs-dev

This will go hand and hand with Custom Form Types, and we could have an option to do "Regex" or "Custom" ; I'm also waiting on this feature and one with OAuth feature to integrate with my project.

As Julien said in Custom Form Types Discussion in the discord server, the easiest solution might be for them to call an endpoint, passing along submission data, and this API endpoint should return the validation result along with error messages if any.

For regex, a box that makes sure a regex is valid before it is used in production would be amazing and maybe integration with a regex generator. I currently use treeben77's regex generator's API to generate my regex automatically.

LawMixer avatar Feb 10 '24 00:02 LawMixer

Hey guys. We just deployed custom validation rules! We don't have docs for yet but it's live already on opnform.com. It does not use regex, but you can combine advanced logic rules with it 👀 I'm resolving this issue, thanks for the request. CleanShot 2024-05-29 at 11 59 50

JhumanJ avatar May 29 '24 10:05 JhumanJ