diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 16e09105..9cc5ec1b 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -41,6 +41,11 @@ class Record extends React.Component { render() { const {recordLoaded, recordSaved, showAlert, record, formTemplate, currentUser} = this.props; + if (!record?.formTemplate) { + if (formTemplate) { + record.formTemplate = formTemplate; + } + } if (recordLoaded.status === ACTION_STATUS.ERROR) { return ; diff --git a/js/components/record/RequiredAttributes.js b/js/components/record/RequiredAttributes.js index 5857e357..2e14b114 100644 --- a/js/components/record/RequiredAttributes.js +++ b/js/components/record/RequiredAttributes.js @@ -24,16 +24,6 @@ class RequiredAttributes extends React.Component { this.i18n = this.props.i18n; } - componentDidMount() { - const {record, formTemplate} = this.props; - - if (!record.formTemplate) { - if (formTemplate) { - record.formTemplate = formTemplate; - } - } - } - render() { const {record, formTemplate} = this.props; const possibleValuesEndpoint = `${API_URL}/rest/formGen/formTemplates`;