Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aureliee123's avatar

select DependsOn another select nova 4

i'm trying to achieve a dependancy between two select fields in nova 4 but it's not working this is the code i'm using

Select::make('Type','type') ->options(function(){ return Option::pluck('type','id'); }),

        Select::make('Valeur','value')
        ->dependsOn(
            ['type'],
            function (Select $field, NovaRequest $request, FormData $formData) {
                if ($formData->type) {
                   
                    $shops = Option::pluck('value','id');
                       
                    $field->options()->show();
                } else {
                    $field->options([])->hide();
                }
            }
        ),
0 likes
0 replies

Please or to participate in this conversation.