check whether input is valid before submitting

This commit is contained in:
MaysWind
2024-08-04 19:50:26 +08:00
parent 0b17251f94
commit f133692002
3 changed files with 15 additions and 0 deletions
@@ -598,6 +598,12 @@ export default {
return !!this.inputEmptyProblemMessage;
},
inputEmptyProblemMessage() {
if (this.type === 'template') {
if (!this.transaction.name) {
return 'Template name cannot be blank';
}
}
return null;
}
},
@@ -762,6 +768,13 @@ export default {
save() {
const self = this;
const problemMessage = self.inputEmptyProblemMessage;
if (problemMessage) {
self.$refs.snackbar.showMessage(problemMessage);
return;
}
if (self.type === 'transaction' && (self.mode === 'add' || self.mode === 'edit')) {
const doSubmit = function () {
self.submitting = true;