mplodowski / formbuilder-plugin-public

https://octobercms.com/plugin/renatio-formbuilder
https://octobercms.com/plugin/renatio-formbuilder
2 stars 0 forks source link

Regex validation doesn't work #23

Closed tillathenun closed 1 year ago

tillathenun commented 1 year ago

Describe the bug My client wants me to stop people entering free e-mail addresses on a form. Regex validation should be able to stop this but I can't get it to work.

To Reproduce Enter this as validation rules:

required|email|regex:[a-zA-Z0-9]{0,}([.]?[a-zA-Z0-9]{1,})[@](gmail.com|hotmail.com|yahoo.com|hotmail.co.uk|yahoo.co.uk|gmail.co.uk)

I know the pipe character causes issues so Laravel documentation recommends using an array structure instead, but I can't get this to work either... unless I'm doing something wrong?! Quite possible!

['required', 'email', 'regex:[a-zA-Z0-9]{0,}([.]?[a-zA-Z0-9]{1,})[@](gmail.com|hotmail.com|yahoo.com|hotmail.co.uk|yahoo.co.uk|gmail.co.uk)']

I get the error message: "Method [validate['required','email','regex] does not exist."

October version Build 465

Plugin version 1.5.0

(Very old versions, sorry — if it'll work on a newer version, I'll upgrade it all.)

thinktrans commented 1 year ago

If I may, I would like to request you to not put in the regex as decided. It invariably leaves the Internationalized Email addresses at bay. If possible, keep it as simple as this: <e-mail local part>@<domain name> Which can be implemented as

For <e-mail local part> - Follow the guidelines by the "Universal Acceptance Steering Group" - UASG-026 - https://uasg.tech/download/uasg-028-considerations-for-naming-internationalized-email-mailboxes-en/

For <domain name>, you can follow any domain validation methodology using standard libraries, depending on your programming language. For the recent studies on the subject, follow the document UASG-018A - https://uasg.tech/download/uasg-018a-ua-compliance-of-some-programming-language-libraries-and-frameworks-en/.

mplodowski commented 1 year ago

From version 3.1.0 plugin uses array syntax for validation.