Skip to content
Advertisement

Laravel can’t get the values from Vue-multiselect

I am using Vue-multiselect with Laravel.

I am using the multiselect component in my form to let the user select multiple countries. The component works fine but when I submit the form and I dd() it, it shows [object Object].

I can’t get the value of the multiselect component. I have found similar questions but none of them worked for me.

Here is my code:

The ExampleComponent.vue file:

JavaScript

Here is my register form:

JavaScript

When I submit the form, the countriespost shows me me this: [object Object] instead of the actual value.

Advertisement

Answer

It’s because you are providing an array of objects as options property:

JavaScript

so the value emited on input is an object. Try to change the options to following:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement