outl1ne / nova-multiselect-field

A Laravel Nova package that adds a multiselect to Nova's arsenal of fields.
MIT License
332 stars 120 forks source link

Use taggable dynamic content in other field dependsOn dynamically #258

Open couchlab-pl opened 3 months ago

couchlab-pl commented 3 months ago

Hi,

Hope someone know the solution or some update needed. Thanks in advance.

I have two fields, one to define list of possible choices, second to choose right answer. Sadly when adding dynamic taggable values to the first field, second does not receive changed event.

Multiselect::make(__('tr.task_choice_options'), 'choice_choices')->hide()->taggable()->saveAsJSON() ->dependsOn( ['task_type'], function ($field, $request, $formData) { if ($formData->task_type === TaskTypeEnum::Choice) { $field->show()->required(); } } ), Multiselect::make(__('tr.task_choice_options'), 'choice_choice')->hide()->singleSelect() ->dependsOn( ['task_type','choice_choices'], function ($field, $request, $formData) { if ($formData->task_type === TaskTypeEnum::Choice) { $field->options(json_decode($formData->choice_choices))->show()->required(); } } )

couchlab-pl commented 1 month ago

Please can you watch for this. I think that is easy to fix because when you removing option with taggable the change event is firing, not working only when adding new tags.

nastoychev commented 1 month ago

I have the same issue.