EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Form validate before skip not modified
Yurii275578c10d10
diff --git a/client/src/views/record/base.ts b/client/src/views/record/base.tsindex 650fbf688b..c4895f40e9 100644--- a/client/src/views/record/base.ts+++ b/client/src/views/record/base.ts@@ -1103,6 +1103,16 @@ class BaseRecordView<S extends BaseRecordViewSchema = BaseRecordViewSchema> exteconst setAttributes = this.getChangedAttributes(Object.keys(fetchedAttributes));+ if (this.validate()) {+ this.afterNotValid();++ this.lastSaveCancelReason = 'invalid';++ this.trigger('cancel:save', {reason: 'invalid'});++ return Promise.reject('invalid');+ }+if (Object.keys(setAttributes).length === 0) {if (!options.skipNotModifiedWarning) {this.afterNotModified();@@ -1115,16 +1125,6 @@ class BaseRecordView<S extends BaseRecordViewSchema = BaseRecordViewSchema> extereturn Promise.reject('notModified');}- if (this.validate()) {- this.afterNotValid();-- this.lastSaveCancelReason = 'invalid';-- this.trigger('cancel:save', {reason: 'invalid'});-- return Promise.reject('invalid');- }-if (options.afterValidate) {options.afterValidate();}