I was surprised to see that there is no plugin in the store for the purpose of requiring unique values on fields. I need to create a form that will not let front end users create an account if they enter the same [identifying number] as another user.

Is there no way of configuring custom validation logic for creating an entry, and/or for making a field require a unique value, or am I going to finally be forced into learning how to write a module here?

  • There's no way that I know of except a custom module. But it's not that hard to write a module for a simple task like validation. If you decide to give it a try, look into the craft\elements\Entry::EVENT_DEFINE_RULES, craft\elements\Entry::EVENT_BEFORE_VALIDATE and craft\elements\Entry::EVENT_AFTER_VALIDATE events. – nstCactus Sep 16 '20 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.