I have a document that I would like to validate as a whole before it is published. For instance one bit of validation I need to do is make sure one of the document's children has atleast one child under it. The question is where can I inject my validation logic and be able to provide feedback to the user if there is a problem?
I was thinking of hooking into the Document BeforePublish event and validating there, but there does not appear to be a way to provide feedback to the user if the publish needs to be cancelled.
Then I was thinking about inserting a custom datatype into the Document's properties that would have a asp.net CustomValidator, because umbraco will run those and display the error messages, but then I dont see a way to get at the current document to be able to inspect it's properties. Also, I am not sure if those validators would be fired if you tried to set a future publish date.
How can I enforce document validation and provide feedback to the user if there are problems?
The way I have I have settled on is to do the validation is by hooking into Document.BeforePublish and then creating a custom method for delivering any errors to the ui. The hook into Document.BeforePublish seems like a good method but the error message delivery method is a bit of a hack since you have to get into umbraco's source code a bit.
How to validate a document
I have a document that I would like to validate as a whole before it is published. For instance one bit of validation I need to do is make sure one of the document's children has atleast one child under it. The question is where can I inject my validation logic and be able to provide feedback to the user if there is a problem?
I was thinking of hooking into the Document BeforePublish event and validating there, but there does not appear to be a way to provide feedback to the user if the publish needs to be cancelled.
Then I was thinking about inserting a custom datatype into the Document's properties that would have a asp.net CustomValidator, because umbraco will run those and display the error messages, but then I dont see a way to get at the current document to be able to inspect it's properties. Also, I am not sure if those validators would be fired if you tried to set a future publish date.
How can I enforce document validation and provide feedback to the user if there are problems?
The way I have I have settled on is to do the validation is by hooking into Document.BeforePublish and then creating a custom method for delivering any errors to the ui. The hook into Document.BeforePublish seems like a good method but the error message delivery method is a bit of a hack since you have to get into umbraco's source code a bit.
is working on a reply...