I have a News Pagetype with three different category properties. The business rules state that there needs to be at least one category , out of the three, selected for a news page.
The current validation prompts the validation errormessage when a user creates a new newspages since there isn't a default category selected. I want to move this validation to when the page is published and have tried implementing this with the help of an InitializableModule without success.
Do you guys have any ideas?
You can implement custom validation for a certain contenttype by implementing IValidate<T>, in your case IValidate<NewsPage>, see:
However that validation will be called for each save and not just when the page is published. You can do an approach as described in:
I'm actually the person who implemented the validation solution that we have today that Birger talks about. And I used the approach that you are describing Johan. The problem is that we need it to trigger on publish and not save.