© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
6 replies
Zakhaev

AfterStateUpdate looks like it isnt working

Grid::make(2)->schema([
                    Select::make('chosen_asset')
                        ->label('Selecteer aan middel')
                        ->searchable()
                        ->options(
                            Asset::all()->map(function ($asset) {
                                return [
                                    'id' => $asset->id,
                                    'value' => $asset->name . ' - ' . $asset->brand,
                                ];
                            })->pluck('value', 'id')->toArray()
                        )
                        ->afterStateUpdated(
                            fn (Closure $set, $value) => $set('asset_id', $value)
                        )
                ]),

                Grid::make(2)->schema([
                    TextInput::make('asset_id')
                        ->label('Type'),
Grid::make(2)->schema([
                    Select::make('chosen_asset')
                        ->label('Selecteer aan middel')
                        ->searchable()
                        ->options(
                            Asset::all()->map(function ($asset) {
                                return [
                                    'id' => $asset->id,
                                    'value' => $asset->name . ' - ' . $asset->brand,
                                ];
                            })->pluck('value', 'id')->toArray()
                        )
                        ->afterStateUpdated(
                            fn (Closure $set, $value) => $set('asset_id', $value)
                        )
                ]),

                Grid::make(2)->schema([
                    TextInput::make('asset_id')
                        ->label('Type'),


As you can see in the example above. I have a chosen asset select component. With values of assets. That is working fine. But when some value is selected i want to change other fields according to that.
I try to change the asset_id field below but nothing seems to be working. Can anyone help me with this?
Solution
Instead of
$value
$value
use
$state
$state
, see https://beta.filamentphp.com/docs/3.x/forms/advanced#field-updates
Advanced forms - Form Builder - Filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

afterstateupdate
FilamentFFilament / ❓┊help
2y ago
Open Modal afterStateUpdate?
FilamentFFilament / ❓┊help
3y ago
Pagination number looks like a float
FilamentFFilament / ❓┊help
4mo ago
afterStateUpdate on orderlist in the table
FilamentFFilament / ❓┊help
2y ago