I have a workflow step that posts back to an Umbraco api controller which does some validation.
If the validation fails then any subsequent workflow steps should not occur.
I'm only aware of the manual checkbox to disable workflow steps.
There is also the custom workflow type which returns a WorkflowExecutionStatus enum, but that doesn't seem to affect subsequent execution of workflow steps.
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
Umbraco.Forms.Web.Controllers.UmbracoFormsController.FormValidate += UmbracoFormsController_FormValidate;
}
void UmbracoFormsController_FormValidate(object sender, Umbraco.Forms.Mvc.FormValidationEventArgs e)
{
//Here you can validate the form in e.Form and fill the errors like this:
sender.ModelState.AddModelError("name", "Name is required");
//Where "name" is the alias of the field
//If there are errors in the ModelState the form doesnt continue execution
}
Stop subsequent workflow steps
Hello
I have a workflow step that posts back to an Umbraco api controller which does some validation.
If the validation fails then any subsequent workflow steps should not occur.
I'm only aware of the manual checkbox to disable workflow steps.
There is also the custom workflow type which returns a WorkflowExecutionStatus enum, but that doesn't seem to affect subsequent execution of workflow steps.
Can this be done programmatically?
Any updates on this? how did you got it?
Did you ever find a solution for this?
Yes, you can implement the FormValidate event:
Sorry Tito, is this implemented in your main Umbraco Application or elsewhere?
Hi, you can implement it in any class that inherits ApplicationEventHandler
is working on a reply...