Hey there #Vue.js2 I'm facing an issue while trying to create a function that is called within a form submit event. This particular function needs both the EVENT and ID as parameters. The problem arises when I call this function, as I am unable to specify the event parameter without encountering an error. Consequently, my form data and ID become undefined in the logs. Is there a more efficient way to manage my form?
updatePost(event, id) {
const postId = id;
const updatedPost = new FormData(event.target); // Is there an alternative to using the event parameter for this?
console.log(updatedPost, postId);
},
// Here's how it's called in my Template but:
<form @submit.prevent="updatePost(post.id)">
ps: The form consists of 2 text inputs and 1 file input.View Vue.js screenshot