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

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
}

Related content

How do I set a field to the ‘readonly’ state?
How do I set a field to the ‘readonly’ state?
More like this
How do I make a field required?
How do I make a field required?
More like this
How to: Making fields valid or invalid via custom JS
How to: Making fields valid or invalid via custom JS
More like this
How do I hide a field based on state?
How do I hide a field based on state?
More like this
How do I hide and show a field based on another field's content?
How do I hide and show a field based on another field's content?
More like this
How to: Understand the form field JavaScript Customizability
How to: Understand the form field JavaScript Customizability
More like this