Skip to content
Snippets Groups Projects
Commit df33d27f authored by Marc Hanisch's avatar Marc Hanisch
Browse files

check if form is valid before saving

parent a4773021
No related branches found
No related tags found
2 merge requests!90Draft: restructure frontend properties 2,!82Restructure frontend
......@@ -20,11 +20,10 @@
apply
</v-btn>
</v-card-actions>
<v-card-text>
<DeviceBasicDataForm
v-model="deviceCopy"
/>
</v-card-text>
<DeviceBasicDataForm
ref="basicForm"
v-model="deviceCopy"
/>
<v-card-actions>
<v-spacer />
<v-btn
......@@ -76,6 +75,10 @@ export default class DeviceEditBasicPage extends Vue {
}
onSaveButtonClicked () {
if (!(this.$refs.basicForm as Vue & { validateForm: () => boolean }).validateForm()) {
this.$store.commit('snackbar/setError', 'Please correct your input')
return
}
this.save().then((device) => {
this.$emit('input', device)
this.$router.push('/devices/' + this.deviceId + '/basic')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment