How do I make a field required based on the request’s State?

Step-by-step guide


  1. Click on Modules.
  2. Select the Module with the appropriate form field.
  3. Select the Forms tab.
  4. Select Field List button "Create/Update Fields".
  5. Use filter to find field that is intended to be made readonly.
  6. Select edit on the field.
  7. Select Custom JavaScript tab.
  8. 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
}