belongs-to-many-field-nova icon indicating copy to clipboard operation
belongs-to-many-field-nova copied to clipboard

When a BelongsToManyField 'depends on' another field, if the parent field is updated, the values unmatch.

Open Vaishonline opened this issue 3 years ago • 2 comments

image

BelongsToManyField::make('Questions','questions', 'App\Nova\Question') ->optionsLabel('title') ->showOnUpdating(true) ->dependsOn('class_subject','class_subject_id')

Note that the objects in the BelongsToManyField get filtered based on the value in the field above it. When I update my parent field (in this case Class Subject) to something else, it is allowing me to save the updations even though the selected objects in the BelongsToManyField don't match the parent field anymore (Class Subject).

Is it possible to clear the selected objects in the BelongsToManyField if the parent field is updated?

Vaishonline avatar Mar 17 '21 12:03 Vaishonline

What is the solution of this issue? While we change parent option it should remove the child selected options which is not related to parent. And if we save it with different parent and child options which are not belongs to each other data is saved.

I have to clear child selected data from options when we change parent options. What is the solution of this?

Akanksha-Clarion avatar Oct 20 '21 14:10 Akanksha-Clarion

any solution de this problem

ikramooe avatar Feb 16 '22 20:02 ikramooe