diff --git a/packages/volto/src/components/manage/Form/ModalForm.jsx b/packages/volto/src/components/manage/Form/ModalForm.jsx index e52a8ef77a..354d0cb32b 100644 --- a/packages/volto/src/components/manage/Form/ModalForm.jsx +++ b/packages/volto/src/components/manage/Form/ModalForm.jsx @@ -219,6 +219,20 @@ class ModalForm extends Component { this.props.onChangeFormData(this.state.formData); } } + if (!isEqual(prevProps.formData, this.props.formData)) { + let newFormData = {}; + map(keys(this.props.formData), (field) => { + if (!isEqual(prevProps.formData[field], this.props.formData[field])) { + newFormData[field] = this.props.formData[field]; + } + }); + this.setState({ + formData: { + ...this.state.formData, + ...newFormData, + }, + }); + } } /** diff --git a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx index 70ba12cbae..5dca6c540b 100644 --- a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx @@ -455,6 +455,7 @@ map(['Email', 'label_email'], (factory) => { method: (intl) => ({ type: 'string', widget: 'email', + id: 'email', factory, }), }); @@ -1002,7 +1003,7 @@ class SchemaWidget extends Component { values.factory === 'label_multi_choice_field'; const initialData = utility.method - ? utility.method(this.props.intl) + ? omit(utility.method(this.props.intl), ['id']) : { type: 'string', factory: values.factory, @@ -1613,6 +1614,13 @@ class SchemaWidget extends Component { 'generated', ); + const utility = config.getUtility({ + name: this.state.addField, + type: 'fieldFactoryInitialData', + }); + + const id = utility?.method ? utility.method(this.props.intl).id : undefined; + return (