Skip to content

Commit 327cff9

Browse files
authored
When updating form, if field value is empty, delete the field. (#162)
1 parent 9b06591 commit 327cff9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

frontend/components/DynamicForm.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export default {
2525
},
2626
methods: {
2727
updateForm (fieldName, v) {
28-
this.$set(this.formData, fieldName, v)
28+
if (!v) {
29+
this.$delete(this.formData, fieldName)
30+
} else {
31+
this.$set(this.formData, fieldName, v)
32+
}
2933
this.$emit('input', this.formData)
3034
},
3135
getComponent(field) {

0 commit comments

Comments
 (0)