nova-json icon indicating copy to clipboard operation
nova-json copied to clipboard

outl1ne/nova-multiselect-field is not working with json field

Open scramatte opened this issue 1 year ago • 0 comments

Hello,

outl1ne/nova-multiselect-field is not working with json field field value is not saved. I don't have error on frontend or in laravel.log . Value is just ignored.

...
JSON::make('settings', 'settings', [
            Multiselect::make('Allowed countries', 'allowed_countries')
                ->placeHolder('add a country...')
                ->saveAsJSON()
                ->clearOnSelect()
                ->options(['es' => 'Spain', 'fr' => 'France']),
]),
...

When you directly store value into database as an array, field is filled properly when you edit page string value separated by "," doesn't work.

{"allowed_countries": ["es"]}

imagen

When you save resource, it's look that data on post are sent correctly:

settings->allowed_countries[0] = 'es',
settings->allowed_countries[1] = 'fr',

imagen

Can you take a look?

Regards

scramatte avatar Dec 23 '24 12:12 scramatte