Skip to content

Commit

Permalink
fix: array field wouldn't save empty value (#145)
Browse files Browse the repository at this point in the history
Co-authored-by: Lydia <lydia@township.agency>
  • Loading branch information
lkoller and lkoller committed Jun 17, 2022
1 parent c58b08b commit ef09ca2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions assets/src/components/Form/Array.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ export default {
mounted () {
this.setInitialValue();
this.field.fill = formData => {
this.items.forEach((item, i) => {
formData.append(`${this.field.attribute}[]`, item);
});
if (this.items.length == 0) {
formData.append(`${this.field.attribute}[]`, []);
} else {
this.items.forEach((item, i) => {
formData.append(`${this.field.attribute}[]`, item);
});
}
};
},
Expand Down

0 comments on commit ef09ca2

Please sign in to comment.