F
Filament9mo ago
jw

Get $get function doesn't retrieve value from a field in a different Fieldset

Hi, I'm trying to access the value of 'club_id' using $get('club_id'), however it always returns null. I have xdebug enabled and the function in 'firearm_id' is being called correctly (reactive), but it can't see 'club_id', I presume because it's in another Fieldset? Using $get I can get values from fields within the same fieldset ('Fieldset_2') with no trouble. Is there something else I should be doing in this situation? Code Below Thanks \Filament\Forms\Components\Fieldset::make('Fieldset_1')
->schema([ Select::make('club_id') ->label('Club') ->options( DB::table('clubs as c') ->join('club_members as cm', 'c.id', 'cm.club_id') ->where('cm.user_id', auth()->user()->id) ->pluck('c.name', 'c.id') ) ->live() ->reactive()
->required(), ]), \Filament\Forms\Components\Fieldset::make('Fieldset_2')
->schema([ Select::make('firearm_id') ->live() ->options( function (Get $get) { $club_id = $get('club_id'); // null }) ])
Solution:
FYI, I found the answer by using: $get('data.club_id', true);
Jump to solution
1 Reply
Solution
jw
jw9mo ago
FYI, I found the answer by using: $get('data.club_id', true);
Want results from more Discord servers?
Add your server