diff --git a/frontend/packages/volto-form-block/src/schemaFormBlock/ViewSchemaForm.jsx b/frontend/packages/volto-form-block/src/schemaFormBlock/ViewSchemaForm.jsx index 1a1d45d..073809c 100644 --- a/frontend/packages/volto-form-block/src/schemaFormBlock/ViewSchemaForm.jsx +++ b/frontend/packages/volto-form-block/src/schemaFormBlock/ViewSchemaForm.jsx @@ -117,12 +117,24 @@ const FormBlockView = ({ data, id, properties, metadata, path }) => { const formfields = renderToString( - {map(keys(submittedData), (property) => ( - - {data.schema.properties[property].title} - {submittedData[property]} - - ))} + {map(keys(submittedData), (property) => { + const propertyType = data.schema.properties[property].type; + + // Only render if the type is not 'object' + if (propertyType !== 'object') { + return ( + + + {data.schema.properties[property].title} + + {submittedData[property]} + + ); + } + + // Return null to avoid rendering the row for object types + return null; + })} , ); diff --git a/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/CheckboxGroupWrapper.jsx b/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/CheckboxGroupWrapper.jsx index 1fea0f7..e8c8548 100644 --- a/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/CheckboxGroupWrapper.jsx +++ b/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/CheckboxGroupWrapper.jsx @@ -2,6 +2,7 @@ import { useRef } from 'react'; import PropTypes from 'prop-types'; import config from '@plone/volto/registry'; import { defineMessages, injectIntl } from 'react-intl'; +import { isString, map } from 'lodash'; import FormFieldWrapper from './FormFieldWrapper'; @@ -35,13 +36,25 @@ const CheckboxGroupWrapper = (props) => { const options = choices || []; + const curValue = value + ? isString(value) + ? value.split('\n') + : value + : undefined; + + const curDefault = props.default + ? isString(props.default) + ? props.default.split('\n') + : props.default + : undefined; + return ( {options.length < 6 && ( { id={`field-${id}`} name={id} value={ - (value && { value, label: value }) || - (props.default && { value: props.default, label: props.default }) || + (curValue && + map(curValue, (item) => ({ value: item, label: item }))) || + (curDefault && + map(curDefault, (item) => ({ + value: item, + label: item, + }))) || undefined } label={title} @@ -71,7 +89,12 @@ const CheckboxGroupWrapper = (props) => { isMulti={true} labelRequired={intl.formatMessage(messages.required)} disabled={isDisabled} - onChange={(value) => onChange(id, value.value)} + onChange={(value) => { + return onChange( + id, + map(value, (item) => item.value), + ); + }} ref={ref} onClick={() => onClick()} options={options.map((option) => ({ diff --git a/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/DatetimeWrapper.jsx b/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/DatetimeWrapper.jsx index 0ddf436..d6614e2 100644 --- a/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/DatetimeWrapper.jsx +++ b/frontend/packages/volto-form-block/src/schemaFormBlock/Wrappers/DatetimeWrapper.jsx @@ -36,6 +36,7 @@ const DatetimeWrapper = (props) => { name={id} value={value || null} label={title} + locale={intl.locale} description={description} isRequired={required} labelRequired={intl.formatMessage(messages.required)}