diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 399b3179..5ea824fb 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -240,6 +240,7 @@ Localized input and parsing and validation ----------------- TODO AFTER CLIENT block ABOVE: +ON UPDATE: have an url that opens automatically or a notification and link to one after a new version has been detected just like visual studio does in order to show what is new in this version ABOUT form - add the user settings such as timezone offset, locale formatting patterns etc, will be useful for troubleshooting diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 186c5e81..81605fdc 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -178,8 +178,8 @@ export default { }; }, methods: { - Change(ref) { - this.$gzv.Change(this, ref); + Change(ref) { + this.$gzv.Change(this, ref); }, getDataFromApi() { var url = "Widget/" + this.$route.params.id; @@ -188,21 +188,17 @@ export default { }); }, submit() { - // debugger; + //check if form is valid, as far as I know this is the way you're supposed to do it and in testing it does not force all fields to revalidate individually + if (this.$refs.form.validate()) { + var that = this; + var url = "Widget/" + this.$route.params.id; - //TODO: CHECK FOR BROKEN RULES AND DON'T SUBMIT IF THERE ARE ANY HERE + //clear any errors that might be around from previous submit + this.$gzutil.RemoveAllPropertiesFromObject(this.serverError); - var that = this; - var url = "Widget/" + this.$route.params.id; - - //clear any errors that might be around from previous submit - this.$gzutil.RemoveAllPropertiesFromObject(this.serverError); - - this.$gzapi - .upsert(url, this.obj) - .then(res => { - if (res.error) { - that.serverError = res.error; + this.$gzapi.upsert(url, this.obj).then(res => { + if (res.error) { + that.serverError = res.error; } else { //Logic for detecting if a post or put: if id then it was a post, if no id then it was a put if (res.id) { @@ -214,10 +210,11 @@ export default { } } }); - //In theory all exceptions should be handled by the gzapi methods, so we should not need to deal with this in the form very often if at all - // .catch(function(error) { + //In theory all exceptions should be handled by the gzapi methods, so we should not need to deal with this in the form very often if at all + // .catch(function(error) { // }); - + } else { + } } //end of submit() } };