I have a custom data type (a usercontrol implementing IUsercontrolDataEditor) and I would like to enforce validation on save/publish. Is there a way to cancel the save/publish event on the client side if my custom validation logic fails?
What is the datatype doing? I suppose you might could use some JavaScript dependent on what your datatype does etc....could you ellaborate a bit more on what your datatype is doing?
I dont need help writing the validation logic. I need to know where to hook code in to cancel the save/publish event if the entered data is no good. For the sake of discussion, lets say I have a color picker that needs to validate that the choosen color is close to a specified pallete of colors.
Cancel save/publish event if validation fails
I have a custom data type (a usercontrol implementing IUsercontrolDataEditor) and I would like to enforce validation on save/publish. Is there a way to cancel the save/publish event on the client side if my custom validation logic fails?
Hi Greengiant
What is the datatype doing? I suppose you might could use some JavaScript dependent on what your datatype does etc....could you ellaborate a bit more on what your datatype is doing?
/Jan
Jan,
I dont need help writing the validation logic. I need to know where to hook code in to cancel the save/publish event if the entered data is no good. For the sake of discussion, lets say I have a color picker that needs to validate that the choosen color is close to a specified pallete of colors.
Hi,
I'm not sure you can cancel a save/publish event from a datatype itself. I know you can do it from an Event Handler using e.Cancel = true;
But, I do think you can add a ValidationProperty to your datatype in 4.7+ that might help. See this thread: http://our.umbraco.org/forum/developers/extending-umbraco/14157-Make-custom-datatype-mandatory
-Tom
is working on a reply...