Jul 24, 2023
0
Level 1
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();
}
}
),
Please or to participate in this conversation.