diff --git a/src/ShoppingListItem.js b/src/ShoppingListItem.js index 4c03d9b..df5d3c7 100644 --- a/src/ShoppingListItem.js +++ b/src/ShoppingListItem.js @@ -43,7 +43,13 @@ export class ShoppingListItem { saveButton.textContent = "Speichern"; editForm.addEventListener("submit", (event) => { event.preventDefault(); + const editFormData = Object.fromEntries(new FormData(editForm)); + + if (!editFormData.newItemName && !editFormData.newItemAmount) { + return; + } + this.name = editFormData.newItemName; this.amount = editFormData.newItemAmount; this.isEditing = false;