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
+1
View File
@@ -1633,6 +1633,7 @@
"You have saved this template": "You have saved this template",
"Show Hidden Templates": "Show Hidden Transaction Templates",
"Hide Hidden Templates": "Hide Hidden Transaction Templates",
"Template name cannot be blank": "Template name cannot be blank",
"Are you sure you want to logout from this session?": "Are you sure you want to logout from this session?",
"Unable to logout from this session": "Unable to logout from this session",
"Are you sure you want to logout all other sessions?": "Are you sure you want to logout all other sessions?",
+1
View File
@@ -1633,6 +1633,7 @@
"You have saved this template": "您已经保存该模板",
"Show Hidden Templates": "显示隐藏的模板",
"Hide Hidden Templates": "不显示隐藏的模板",
"Template name cannot be blank": "模板名不能为空",
"Are you sure you want to logout from this session?": "您确定要退出该会话?",
"Unable to logout from this session": "无法退出该会话",
"Are you sure you want to logout all other sessions?": "您确定要退出其他所有会话?",
@@ -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;