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

Episerver make field required based on selected value

Vote:
 

Hi all,

We have a requirement like,

I have a news category dropdown on Episerver page type which is holding different options.

When cms editor selects one particular news category from options(User Alerts), the other field (Alert Text) which is the text editor, should make it a mandatory field before publishing.

And this (Alert Text) text editor field is not mandatory for other new category types.

How to achieve this requirement.

Appreciate your help. Many thanks in advance.

#287117
Sep 12, 2022 23:57
Vote:
 

Could this article also help : Refresh current editing context on property value change (optimizely.com) 

It details how you can change the state of one property based on another. 

#287123
Sep 13, 2022 10:47
Vote:
 

If you do not require the UI to change, and visually indicate that the other fields become mandatory, the easiest approach is to create a custom validator using the IValidate<T> interface.

https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/validating-object-instances

#287127
Sep 13, 2022 12:12
* 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.