Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Episerver Forms Conditional Validation


Currently struggling with a piece of functionality on an Episerver implementation. 

Basically I need to implement conditional validation on an Episerver Forms field. E.g. TextBox2 is required is TextBox1 has a value of 1, but is not required when TextBox1 has other values.

I have looked into custom validators but I am unclear how I might extend the validator to have additional properties for the field name I want to target and the value it should have in order for the validation to perform the check.

If anybody has any insight on achieving this it would be appreciated.


Dec 20, 2016 16:53

Don't know if this is too late for you, but this URL has the info you need:

In my case:

public IEnumerable<ValidationError> Validate(HomePage instance)

if (instance.FooterSettings.ShowChannelOne)
if(String.IsNullOrEmpty(instance.FooterSettings.ChannelOneURL) || instance.FooterSettings.ChannelOneIcon == null ||
instance.FooterSettings.ChannelOneHover == null || String.IsNullOrEmpty(instance.FooterSettings.ChannelOneTooltip))
return new[]
new ValidationError
ErrorMessage = "Mandatory to fill out rest of Channel 1 fields (URL, Icons * 2, Tooltip)",
PropertyName = "ShowChannelOne",
Severity = ValidationErrorSeverity.Error


Edited, Jan 04, 2017 16:40
* 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.