Toggle menu

helper.showFieldWhen(fieldNames, condition, emptyField)

This function will show one or more hidden 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 show them all if a condition is met. If the condition is not met, the fields will be hidden.

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

.hideFieldWhen performs the opposite.

Arguments

ArgumentTypeDescription
fieldNamesArray, requiredThe names of the fields to be shown
conditionExpression, requiredThe expression should return true or false, and will determine whether the fields are shown (true) or hidden (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 shown when the value of the current field (a radio button group) is "show".

showFieldWhen

function(helper, fieldName, value, valid, eventName) {
    let fields = ['FIELD20', 'FIELD22', 'FIELD30', 'FIELD23'];
    helper.showFieldWhen(fields, value == 'show', false);
}

Last modified on 11 September 2026