Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Vaishonline opened this issue Mar 17, 2021 · 2 comments
Labels
bug Something isn't working to-review This solution seems to work

Comments

@Vaishonline
Copy link

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?

@Akanksha-Clarion
Copy link

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?

@ikramooe
Copy link

any solution de this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working to-review This solution seems to work
Projects
None yet
Development

No branches or pull requests

4 participants