diff --git a/classes/Form.php b/classes/Form.php index dad2974b..51a689c6 100644 --- a/classes/Form.php +++ b/classes/Form.php @@ -870,6 +870,9 @@ public function post() if ($field['type'] === 'checkbox' || $field['type'] === 'switch') { $data[$name] = isset($data[$name]) ? true : false; } + if ($field['type'] === 'checkboxes' && !isset($data[$name])) { + $data[$name] = []; + } $i++; } diff --git a/templates/forms/fields/checkboxes/checkboxes.html.twig b/templates/forms/fields/checkboxes/checkboxes.html.twig index ba9a6506..8f548598 100644 --- a/templates/forms/fields/checkboxes/checkboxes.html.twig +++ b/templates/forms/fields/checkboxes/checkboxes.html.twig @@ -2,7 +2,7 @@ {% set originalValue = value %} {% set value = (value is null ? field.default : value) %} -{% if field.use == 'keys' and field.default %} +{% if field.use == 'keys' and field.default and value is null %} {% set value = field.default|merge(value) %} {% endif %}