mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
check whether input is valid before submitting
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user