Skip to content
  • There are no suggestions because the search field is empty.

How to Make a 'Corrective Action' Field Required Based on Another Field's Numerical Range"

You can make the 'Comment - Corrective Action' field required based on the value of another field by setting up a specific series of validation rules on the comment field itself. 

In this example, the validation on the 'Comment - Corrective Action' field (let's call its name "CorrectiveAction"), based on the value of 'Field A' (let's call its name "Field A").

Validation Rules for 'Comment - Corrective Action' Field

You will create three separate rules on the CorrectiveAction field. The rules are checked from top to bottom.

Rule 1: Valid (Comment is Optional)

This rule marks the comment field as valid (and optional) if 'Field A' is in the valid range (5-8).

(data["FieldA"] >= 5) && (data["FieldA"] <= 8)
  • Mark form as: Valid
  • With message: "no action needed."

Tested:

Rule 2: Invalid (Required but Empty)

This rule marks the comment field as valid only if 'Field A' is in the invalid range (0-4.99 or 8.01-10) AND the comment box is not empty.

(((data["Field A"]>=0)&&(data["Field A"]<5))||((data["Field A"]>8)&&(data["Field A"]<=10)))&&(data["CorrectiveAction"]!=0)
  • Otherwise, mark form as: Valid

  • With message: "Corrective action provided.

Tested:

Rule 3: Invalid (Required but Empty)

This rule makes the comment field invalid if 'Field A' is in the invalid range (0-4.99 or 8.01-10), but the user has not filled in the comment box.

((data["Field A"]>=0)&&(data["Field A"]<5))||((data["Field A"]>8)&&(data["Field A"]<=10))
  • Otherwise, mark form as: Invalid or Error

  • With message: "A corrective action comment is required when the value is out of range."

Tested: