Have you seen this recent blog post
https://www.codeart.dk/blog/2019/11/episerver-forms-adding-custom-validators-to-existing-elements/
I am not 100% sure about if will work for you, but this can give you heads-up. Best of luck :)
the closest I got was using IContentEvents
. it of course look like page is expired (updated UI + yellow bar), but editor will also see validation error (if you cancel ContentSavingEvent)..
couldn't find better way
i would love to have events on expiry, its strange they dont exist now, expiry goes around the publishing process, would be great if Epi could pick this up as a feature enhacement to allow hooks into expiry for validation etc
Benjamin,
Please submit your enhancement request to https://world.episerver.com/forum/developer-forum/Feature-requests/.
Validation for Manage Expiration and archiving can be done by below methods:
I am well aware of how custom validation of regular properties can be done, but how can I validate the input in the window for «Manage Expiration and Archiving»?
I would like to make «Archive to» required for some page types, if «Expire date» has a value.
I have tried adding this:
The code runs when the expiration date are saved, but the validation message are not shown until other changes are published. Most of the time there are no other changes, so the validation message will never be shown.
How can I solve this?