Register FormValidateNotification handler in startup pipeline
Hi,
Kindly asking for help registering handler in my startup pipeline as per the documentation on "Form validation notification". The documentation says:
To register the handler, add the following code into the startup pipeline. In this example, the registration is implemented as an extension method to IUmbracoBuilder and should be called from Startup.cs
But when I add the code to my startup, I get two issues:
"extension method must be defined in a non-generic static class":
"Not all code paths return a value":
When I make my startup class static, that creates more errors on my declared variables.
To fix this issue, add the extension method in a separate static class e.g
public static class FormValidationExtension
{
public static IUmbracoBuilder AddUmbracoFormsCoreProviders(this IUmbracoBuilder builder) => builder.AddNotificationHandler<FormValidateNotification, FormValidateNotificationHandler>();
}
Note that in the code above, I have modified the method into an expression to remove the "not all code paths return a value" error.
Register FormValidateNotification handler in startup pipeline
Hi,
Kindly asking for help registering handler in my startup pipeline as per the documentation on "Form validation notification". The documentation says:
But when I add the code to my startup, I get two issues:
When I make my startup class static, that creates more errors on my declared variables.
Thank you.
To fix this issue, add the extension method in a separate static class e.g
Note that in the code above, I have modified the method into an expression to remove the "not all code paths return a value" error.
Then, in the Startup.cs file, add the following:
Note the AddUmbracoFormsCoreProviders()
That should resolve the issue.
is working on a reply...