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 am trying to build some custom validation for products. I need to validate fields on an Extended Content Type.
As a test I wanted to see if I can cancel the Saving event. I tried the following:
public class ProductValidationEventHandler : ApplicationEventHandler
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,
ProductService.Saving += ValidateProduct; // rasied before the content has been saved.
private void ValidateProduct(IProductService sender, SaveEventArgs<IProduct> e)
e.CancelOperation(new EventMessage("Validation", "TEST - THIS SHOULD NOT SAVE", EventMessageType.Error));
While the code is called, and the save appears to be cancelled, the message is not being displayed.
Am I using the right event? Is there another approach to custom validation in Merchello?
Do you want to see validation message in the Umbraco back office?
Did you solve your issue? Can I help you?
Sorry for the late reply, I was away from the office.
I haven't solved it - I got sidetracked by other work. To answer your question, yes I'm trying to get the event message to show up in the back office.
The back story is we have a merchello integration with several kinds of product (each with their own DocType). In one of the products I have a product picker to select related items. However I want to limit that picker to only allow a subset of the available product types.
My plan was to implement a validation handler to check that and show an error / disable the save. Not sure if this is the correct or best approach :)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted