You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Detailed steps to reproduce the issue on a fresh Nova installation:
Install the package BelongsToManyField using the command:
composer require benjacho/belongs-to-many-field
When I update the value in Class Subject, even if I don't reselect the Questions, it allows me to update and save the changes. In this case, the relationship is violated as the Questions will not belong to the updated Class Subject.
Description:
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?
Detailed steps to reproduce the issue on a fresh Nova installation:
Install the package BelongsToManyField using the command:
composer require benjacho/belongs-to-many-field
Create a resource with the code shown below:
When I update the value in Class Subject, even if I don't reselect the Questions, it allows me to update and save the changes. In this case, the relationship is violated as the Questions will not belong to the updated Class Subject.
Benjacho/belongs-to-many-field-nova#75 (comment)
The text was updated successfully, but these errors were encountered: