November Happy Hour will be moved to Thursday December 5th.

Custom validation on Publish event

Vote:
 

Hi

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?

Regards,
Birger

#74523
Aug 30, 2013 11:52
Vote:
 

You can implement custom validation for a certain contenttype by implementing IValidate<T>, in your case IValidate<NewsPage>, see:

http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/7/Validation/Validation/

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:

http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=71583&

#74538
Aug 30, 2013 14:42
Vote:
 

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.

#74602
Sep 02, 2013 18:23
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.