Skip to content

Commit 52744f2

Browse files
committed
Fix default value of checkbox group widget.
1 parent ebf1d7d commit 52744f2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

frontend/packages/volto-form-block/src/components/ViewSchemaForm.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
pickBy,
1818
without,
1919
isObject,
20+
isString,
2021
fromPairs,
2122
} from 'lodash';
2223
import { Grid, Message } from 'semantic-ui-react';
@@ -57,8 +58,17 @@ const FormBlockView = ({ data, id, properties, metadata, path }) => {
5758
initialData[property] = queryParams[property];
5859
}
5960

60-
const queryParameterName =
61-
data.schema.properties[property].queryParameterName;
61+
const field = data.schema.properties[property];
62+
63+
if (
64+
field.factory &&
65+
field.factory === 'checkbox_group' &&
66+
isString(field.default)
67+
) {
68+
initialData[property] = field.default.split('\n');
69+
}
70+
71+
const queryParameterName = field.queryParameterName;
6272

6373
if (
6474
queryParameterName !== undefined &&

0 commit comments

Comments
 (0)