Project

General

Profile

Actions

Feature #102077

closed

Custom default value for getFormValue() function in variant conditions

Added by Mathias Brodala about 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
Start date:
2023-10-02
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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", [])
Actions

Also available in: Atom PDF