diff --git a/src/formDesigner/views/FormDetails.js b/src/formDesigner/views/FormDetails.js index 519c42f1c..2af638e36 100644 --- a/src/formDesigner/views/FormDetails.js +++ b/src/formDesigner/views/FormDetails.js @@ -125,7 +125,6 @@ class FormDetails extends Component { name: "", timed: false, errorMsg: "", - saveCall: false, createFlag: true, activeTabIndex: 0, successAlert: false, @@ -659,7 +658,7 @@ class FormDetails extends Component { "visitScheduleRule", "generateVisitScheduleRule" ); - flag = isValidationError || isDecisionError || isVisitScheduleError; + flag = isValidationError || isDecisionError || isVisitScheduleError || draft.nameError; _.forEach(draft.form.formElementGroups, group => { group.errorMessage = {}; group.error = false; @@ -728,9 +727,9 @@ class FormDetails extends Component { if (numberElementError !== 0) errormsg += " and " + numberElementError + " form element."; } else if (numberElementError !== 0) errormsg += "There is a error in " + numberElementError + " form element."; } - draft.saveCall = !flag; draft.errorMsg = errormsg; - }) + }), + () => flag === false && this.updateForm() ); } @@ -796,7 +795,6 @@ class FormDetails extends Component { if (response.status === 200) { this.setState({ redirectToWorkflow: true, - saveCall: false, successAlert: true, defaultSnackbarStatus: true, detectBrowserCloseEvent: false @@ -806,7 +804,6 @@ class FormDetails extends Component { .then(() => this.getForm()) .catch(error => { this.setState({ - saveCall: false, errorMsg: "Server error received " + error.response.data }); }); @@ -1017,7 +1014,6 @@ class FormDetails extends Component { defaultSnackbarStatus={this.state.defaultSnackbarStatus} /> )} - {this.state.saveCall && !this.state.nameError && this.updateForm()} );