Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I need some help regarding the form validate event of the Umbraco Forms.
The event is doing the work that I am instructing, that validating email address and password matching of a registration form but errors are not being shown next to the fields.
I have the below code:
void UmbracoFormsController_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e)
if (e.Form.Name == "Registration Form")
var s = sender as Controller;
if (s != null)
var pwf = e.Form.AllFields.SingleOrDefault(f => f.Alias == @ConstantNames.RegistrationPasswordPropertyAliasName).Id.ToString();
var rpwf = e.Form.AllFields.SingleOrDefault(f => f.Alias == @ConstantNames.RegistrationConfirmPasswordPropertyAliasName).Id.ToString();
var password = e.Context.Request[pwf];
var repeatpassword = e.Context.Request[rpwf];
if (password != repeatpassword)
s.ModelState.AddModelError(rpwf, "Password does not match!");
/*Validating Email Address, if it exists*/
var memberService = ApplicationContext.Current.Services.MemberService;
var emailAddress = e.Form.AllFields.SingleOrDefault(f => f.Alias == @ConstantNames.RegistrationEmailPropertyAliasName).Id.ToString();
var userEmailAddress = e.Context.Request[emailAddress];
if (memberService.GetByEmail(userEmailAddress) != null)
s.ModelState.AddModelError(emailAddress, "Email Already Exists!");
Now, even when a debugged this problem, when I insert a breakpoint in the form.cshtml, after the valdiation it does not enter.
Basically I want to inform the user about the errors because as it is, if user try to register with an incorrect email address that is already exists or with passwords that does not match, it just refreshes the page with empty fields, with any error info.
Any ideas or help please?
Thank you in advance.
Anyone can help me please?
Did you ever figure this out?
I need to support an old website which uses Umbraco Forms and get the error:
UmbracoFormsController does not contain a definition for a 'FormValidate'
Late to the game, sure you solved this by now but thought I would drop an example for anyone else.
Working example below.. Although we do custom validation on specific Workflows. Aka If a form has a workflow (guid), execute this extra validation, rather than using the Form Name or Form Id. Found it a bit more re-usable for some of our more advanced workflows, like processing credit cards with Uforms and that sort of thing.
But sounds like missing event binding!
public class UmbracoFormsValidationOnWorkflow : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
// Umbraco started, hook into u forms events
Umbraco.Forms.Web.Controllers.UmbracoFormsController.FormValidate += UmbracoForms_FormValidate;
Umbraco.Forms.Data.Storage.RecordStorage.RecordInserting += RecordStorage_RecordInserting;
RecordStorage.RecordUpdating += RecordStorage_RecordUpdating;
private void UmbracoForms_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e)
Form theForm = e.Form;
// get the workflows
List<Workflow> workflows = wfs.GetAllWorkFlows(theForm);
// get a specific workflow
Workflow specificWorkflow = workflows.FirstOrDefault(a => a.WorkflowTypeId.ToString().ToLower() == "ffbbccdd-e7a6-44db-95aa-5acdccee470f");
// custom validation if a specific workflow exists on the form
if (specificWorkflow != null)
// grab a workflow field value
string workflowsettingvalue = specificWorkflow.Settings["SomeFieldValue"];
.. do more validation because this workflow is on the form
private void RecordStorage_RecordUpdating(object sender, RecordEventArgs e)
Form form = e.Form;
private void RecordStorage_RecordInserting(object sender, RecordEventArgs e)
Form form = e.Form;
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted