cretueusebiu / vform

Handle Laravel-Vue forms and validation with ease.
https://vform.vercel.app
MIT License
607 stars 120 forks source link

Sending Form-Data with array value #134

Closed ahmed-aliraqi closed 3 years ago

ahmed-aliraqi commented 3 years ago

Thank you for amazing plugin, When you sending form-data with array value it will not working correctly, so I suggest to map it before sending, see the following example:


data() {
    return {
        form: new Form({
            users: [
                {name: "", email: ""},
                {name: "", email: ""},
            ]
        })
    }
}
...
onSubmit() {
    let form;
    this.form.users.forEach((user, index) => {
      form[`users[${index}][name]`] = user.name;
      form[`users[${index}][email]`] = user.email;
    });
}
cretueusebiu commented 3 years ago

There is no need for such thing. Arrays will be sent correctly.