Issue Feature Closed

#102077Custom default value for getFormValue() function in variant conditions

Mathias Brodala 10/02/23, 09:20 updated 01/30/24, 08:25

Description

The “form” extension provides a getFormValue() function to be used in variant conditions. It allows accessing form values without triggering an “undefined array index” error in PHP.

However, it unconditionally returns null in case a form value is undefined. This should be extended to optionally provide a custom default/fallback value. This would shorten conditions considerably, e.g. when checking for values of a MultiCheckbox field:

_.Before _.After
getFormValue(“multiCheckboxField”) && “foo” in getFormValue(“multiCheckboxField”) “foo” in getformValue(“multiCheckboxField”, [])

Reviews 1