diff --git a/js/components/record/Record.js b/js/components/record/Record.js index 17389e3a..16e09105 100644 --- a/js/components/record/Record.js +++ b/js/components/record/Record.js @@ -59,7 +59,7 @@ class Record extends React.Component { {this._showInstitution() && this._renderInstitution()} - {this._renderForm()} + {record.formTemplate && this._renderForm()} {this._renderButtons()} {showAlert && recordSaved.status === ACTION_STATUS.ERROR &&
diff --git a/js/components/record/RecordForm.js b/js/components/record/RecordForm.js index d1d245eb..a05ec9d6 100644 --- a/js/components/record/RecordForm.js +++ b/js/components/record/RecordForm.js @@ -34,14 +34,16 @@ class RecordForm extends React.Component { } componentDidMount() { - this.props.loadFormgen(ACTION_STATUS.PENDING); - this.loadWizard(); + if(this.props.record.formTemplate) { + this.props.loadFormgen(ACTION_STATUS.PENDING); + this.loadWizard(); + } } componentDidUpdate(prevProps, prevState, snapshot) { const {record} = this.props; - - if (prevProps.record.question?.uri !== record.question?.uri) { + if(record.formTemplate && record.formTemplate != prevProps.record.formTemplate) { + this.props.loadFormgen(ACTION_STATUS.PENDING); this.loadWizard(); } } @@ -119,7 +121,7 @@ class RecordForm extends React.Component { return ; - } else if (this.props.formgen.status === ACTION_STATUS.PENDING || !this.state.form) { + } else if (!!this.props.record.formTemplate && (this.props.formgen.status === ACTION_STATUS.PENDING || !this.state.form)) { return ; } diff --git a/js/components/record/RequiredAttributes.js b/js/components/record/RequiredAttributes.js index 4f8a651d..5857e357 100644 --- a/js/components/record/RequiredAttributes.js +++ b/js/components/record/RequiredAttributes.js @@ -44,6 +44,7 @@ class RequiredAttributes extends React.Component {
{ isSearchable={true} isLoading={isLoading} isClearable={true} - isDisabled={isLoading} + isDisabled={isLoading || (props.isDisabled === true) } value={options.filter((option) => option.id === props.value)} placeholder={''} getOptionLabel={(option) => option.name} @@ -73,7 +73,8 @@ TypeaheadAnswer.propTypes = { possibleValuesEndpoint: PropTypes.string.isRequired, label: PropTypes.string.isRequired, value: PropTypes.string, - onChange: PropTypes.func.isRequired + onChange: PropTypes.func.isRequired, + isDisabled: PropTypes.bool }; export default TypeaheadAnswer; \ No newline at end of file