Toggle menu

helper.hideFieldWhen(fieldNames, condition, emptyField)

This function will hide one or more fields on the current page when a given condition is met.

Unlike .showField and .hideField, which can be used to show or hide one field at a time as part of a function you have written, this function takes an array of field names and will hide them all if a condition is met. If the condition is not met, the fields will be shown.

It is also able to clear any values entered into the fields as part of the show/hide.

.showFieldWhen performs the opposite.

Arguments

ArgumentTypeDescription
fieldNamesArray, requiredThe names of the fields to be hidden
conditionExpression, requiredThe expression should return true or false, and will determine whether the fields are hidden (true) or shown (false)
emptyFieldBoolean, requiredIf true the values of the named fields will also be cleared when they are hidden

Returns

None.

Example

In this example, all of the named fields will be hidden when the value of the current field (a radio button group) is "hide". The values will also be cleared.

hideFieldWhen

function(helper, fieldName, value, valid, eventName) {
    let fields = ['FIELD20', 'FIELD22', 'FIELD30', 'FIELD23'];
    helper.hideFieldWhen(fields, value == 'hide', true);
}

Last modified on 11 September 2026