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
| Argument | Type | Description |
|---|---|---|
| fieldNames | Array, required | The names of the fields to be shown |
| condition | Expression, required | The expression should return true or false, and will determine whether the fields are shown (true) or hidden (false) |
| emptyField | Boolean, required | If 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".

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