I am looking at adding validation to a Start Date and End Date - where the user can not enter an End Date before the Start Date. The code is in the pageType and will be used in the CMS for a page set up.
Is there any way that this can be done?
Have you tried to write your own validation class that implements IValidate interface?
You could also use an InitializableModule to hook into the saving event:
// inside Initialize
ServiceLocator.Current.GetInstance<IContentEvents>().SavingContent += DisplayModesInitialization_SavingContent;
void DisplayModesInitialization_SavingContent(object sender, ContentEventArgs e)
e.CancelAction = true;
e.CancelReason = "Your error message";
This does not seem to work in neither 7.12.1 nor 7.14.1 (I tried upgrading since it did not work in 7.12.1).
I receive the following:
After which the whole UI gets slow and hardly works. Bug?
Image upload does not seem to work either. :)Here's a link: http://uploadpie.com/td2bX
I wrote a blog post a while back about using the IValidator interface that may be of use: http://www.david-tec.com/2012/06/EPiServer-7-Preview---IValidator-interface/
Thank you David! It's really a clean approach! :)