I have a Block Type which has these two properties.
[CultureSpecific]
[Display(
Name = "Display PDF Button", GroupName = TabNames.PDFCustomisation, Order = 0)]
public virtual bool DisplayPdfButton { get; set; }
[CultureSpecific]
[Required]
[Display(
Name = "Download Pdf Text", GroupName = TabNames.PDFCustomisation, Order = 1)]
public virtual string DownloadPdfText { get; set; }
I only want DownloadPdfText to be required if the user sets DisplayPdfButton to True. - Is this possible to do in Episerver?
One way of doing this is to implement your own validation attribute. You can make it validate to false if DisplayPdfButton is checked and DownloadPdfText is empty. Read about how to do it here: https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Properties/Property-types/Writing-custom-attributes/