Kentico 12 MVC Form Unique entry

Geo Neeliyara asked on August 19, 2020 16:59


i have a form built on Kentico 12 MVC (12.0.79). I just want to avoid duplication while submitting the form. Is there any way to accomplish this? I just want to use name or email address field for verification to avoid duplication

Regards, Geo

Recent Answers

Liam Goldfinch answered on August 20, 2020 00:39


At first I was going to recommend looking at writing a custom validation rule but I don't think it's easy to get the current form context within the validation rule, you just get the submitted value to be validated.

So, the next best thing is probably to register a module which handles global events (ideally the before insert event), then you can check for a used email address and cancel the insertion. I've created a gist with some sample code that works well on the Dancing Goat sample site, see here This will prevent the same email address being used, but the error message displayed to the end user is just a generic submission has failed error message.

If you need to display a custom error message, you might need to look into rendering the form without the pagebuilder, maybe read up on this article and you can write your own custom logic within the controller.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.