diff --git a/src/components/record/Record.jsx b/src/components/record/Record.jsx
index 4ae897a0..8b4a2f60 100644
--- a/src/components/record/Record.jsx
+++ b/src/components/record/Record.jsx
@@ -25,6 +25,7 @@ class Record extends React.Component {
this.recordForm = React.createRef();
this.state = {
isFormValid: false,
+ form: null,
};
}
@@ -42,6 +43,10 @@ class Record extends React.Component {
this.setState({ isFormValid });
};
+ updateForm = (form) => {
+ this.setState({ form });
+ };
+
render() {
const { record, formTemplate, currentUser } = this.props;
@@ -100,6 +105,8 @@ class Record extends React.Component {
formgen={formgen}
currentUser={this.props.currentUser}
isFormValid={this.isFormValid}
+ form={this.state.form}
+ updateForm={this.updateForm}
/>
) : null;
}
diff --git a/src/components/record/RecordForm.jsx b/src/components/record/RecordForm.jsx
index 57a36af3..68f2e235 100644
--- a/src/components/record/RecordForm.jsx
+++ b/src/components/record/RecordForm.jsx
@@ -24,9 +24,8 @@ class RecordForm extends React.Component {
constructor(props) {
super(props);
this.i18n = this.props.i18n;
- this.state = {
- form: null,
- };
+ this.form = this.props.form;
+ this.updateForm = this.props.updateForm;
this.refForm = React.createRef();
}
@@ -45,7 +44,9 @@ class RecordForm extends React.Component {
loadWizard() {
trackPromise(this.props.loadFormgen(this.props.record), "sform")
- .then((data) => this.setState({ form: data }))
+ .then((data) => {
+ this.props.updateForm(data);
+ })
.catch(() => Logger.error("Received no valid wizard."));
}
@@ -105,10 +106,10 @@ class RecordForm extends React.Component {
return (
<>
- {!!this.state.form && (
+ {!!this.props.form && (