Inheriting FormsControl - how can I add custom validation
I have a specific form I have developed that inherits from the standard FormsControl. I need to be able to add an error message to the screen if custom condition of mine fails when submitted. This type of validation falls outside of what I can configure within the back-end, as it requires a web service call prior to submission.
How can I simply add an error message to the UI? Is there a collection of errors that I can append to, that, if any exist, will invalidate the form? Thanks.
Hello Ryan,
There is a blogpost which will help you achieve your requirement:
http://www.sitefinity.com/blogs/stanislav-velikovs-blog/2013/09/20/server-side-captcha-for-sitefinity-forms
What you seek is the following:
base
.BeforeFormSave +=
new
EventHandler<CancelEventArgs>(
this
.FormsControlCustom_BeforeFormSave);