Improve task order upload validation handling.

- Display validation errors.
- Rerender validated form data correctly.
- Clear error state correctly.
This commit is contained in:
dandds
2019-06-06 13:40:50 -04:00
parent 318257e32c
commit 159360692f
6 changed files with 48 additions and 14 deletions

View File

@@ -19,17 +19,15 @@ export default {
initialData: {
type: String,
},
uploadErrors: {
type: Array,
default: () => [],
initialErrors: {
type: Boolean,
},
},
data: function() {
const pdf = this.initialData
return {
attachment: pdf || null,
attachment: this.initialData || null,
showErrors: this.initialErrors,
}
},
@@ -39,11 +37,13 @@ export default {
},
addAttachment: function(e) {
this.attachment = e.target.value
this.showErrors = false
},
removeAttachment: function(e) {
e.preventDefault()
this.attachment = null
this.$refs.attachmentInput.value = null
this.showErrors = false
},
},