This function will make the current field required when the supplied condition is true.
This function is typically used alongside .hideFieldWhen and .showFieldWhen when showing or hiding multiple fields. It can be used in validation functions of the fields being shown/hidden to set them as required.
.showFieldOptionalWhen and .showFieldRequiredWhen can be used to update the field labelling with the appropraite required or optional marker.
Arguments
| Argument | Type | Description |
|---|---|---|
| condition | Expression, required | The expression should return true or false, and will determine whether the field is required or not |
Returns
None.
Example
This example is used in the validation function of a field. If the value of FIELD32 is "show", this field will become required.

function(helper, value) {
let isValid = helper.validateRequiredWhen(helper.getFieldValues('FIELD32') == 'show');
return isValid;
}
Last modified on 11 September 2026
