#102077Custom default value for getFormValue() function in variant conditions
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
History 38
-
Mathias Brodala changed subject
Default value for getFormValue() function in variant conditionsCustom default value for getFormValue() function in variant conditions 10/02/23, 09:20 -
Gerrit Code Review pushed patch set 1 for main to change 81307 status
NewUnder Review 10/02/23, 09:24 -
Gerrit Code Review pushed patch set 2 for main to change 81307 10/02/23, 09:51
-
Gerrit Code Review pushed patch set 3 for main to change 81307 10/02/23, 14:59
-
Gerrit Code Review pushed patch set 4 for main to change 81307 11/27/23, 07:52
-
Gerrit Code Review pushed patch set 5 for main to change 81307 11/27/23, 11:36
-
Mathias Brodala commented and changed status
Under ReviewResolved done0 %100 % 11/29/23, 20:50 -
Benni Mack changed status
ResolvedClosed 01/30/24, 08:25
Applied in changeset commit:7b6ed162383fa36000a826fd2ac089b8c0dbaffb.