Dave Wize's avatar

Nova clears dependent dropdowns on replicate!

I'm using laravel nova in a project and if I do a dependent field on a dropdown and then doing a replicate and I change the value of the fields that the others depemnds on it is being cleared on the replicated record


   BelongsTo::make('Title', 'brideFatherTitleFront', Title::class)
                ->relatableQueryUsing(function (NovaRequest $request, Builder $query) {
                    $query->whereFront(1);
                })
                ->onlyOnForms()
                ->dependsOn(['eventType'], function (Field $field, NovaRequest $request, FormData $formData) {
                    if (!in_array($formData['eventType'], [1, 3, 4, 6, 9, 10])) {
                        $field->hide();
                    }
                }),

This code show the dropdown. Now if I'm going to change the eventType field's value on the replicate form, instead of updating its children it will just clear the children...

0 likes
1 reply
Dave Wize's avatar

I noticed now that it gets cleared even on a regular create or update form, not just on the replicate. So if I update the parent filed, all children dropdowns are being reset.

Please or to participate in this conversation.