How do I make a field required based on the request’s State?
Step-by-step guide
Click on Modules.
Select the Module with the appropriate form field.
Select the Forms tab.
Select Field List button "Create/Update Fields".
Use filter to find field that is intended to be made readonly.
Select edit on the field.
Select Custom JavaScript tab.
Within the “init” section type
NOTE: the “Pending Dev ECM” can be change to any existing state as needed
if(State === “Pending Dev ECM”)
{
if (!fieldScope.fieldSchema.validation) {
//If validation object does not exist, create it.
fieldScope.fieldSchema.validation = {};
}
fieldScope.fieldSchema.validation.required = true
}