diff --git a/app/javascript/components/record-form/form/record-form.jsx b/app/javascript/components/record-form/form/record-form.jsx index dc0c82a085..26ffbeda6a 100644 --- a/app/javascript/components/record-form/form/record-form.jsx +++ b/app/javascript/components/record-form/form/record-form.jsx @@ -67,7 +67,7 @@ function RecordForm({ const bindRecalculateFields = recalculateFields => { bindedRecalculateFields.current = recalculateFields; - } + }; const buildValidationSchema = formSections => { const schema = formSections.reduce((obj, item) => { @@ -186,7 +186,7 @@ function RecordForm({ if (typeof bindedRecalculateFields.current === "function") { bindedRecalculateFields.current(); } - }) + }); const handleConfirm = onConfirm => { onConfirm(); @@ -202,7 +202,6 @@ function RecordForm({ formikValues.current = values; }; - if (!isEmpty(initialValues) && !isEmpty(forms)) { const validationSchema = buildValidationSchema(forms); const handleOnSubmit = values => { @@ -231,6 +230,7 @@ function RecordForm({ if (values) { calculatedFields.forEach(field => { const result = parseExpression(field.calculation.expression).evaluate(values); + if (values[field.name] !== result) { setFieldValue(field.name, result, false); }