© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
13 replies
Alexandre

afterStateUpdated not work on custom field

Hi 👋, I've created a new “TypeCylinder” field in my form. It works fine, except that I can't get the afterStateUpdated() method to work, as it never seems to be called... Any idea why?

Here the input on the form :
CylinderType::make('content.cylinder_type.value')
    ->options(array(
        __('users/requests.field.1') => __('users/requests.field.1'),
        __('users/requests.field.2') => __('users/requests.field.2'),
        __('users/requests.field.3') => __('users/requests.field.3')
    ))
    ->hiddenLabel()
    ->afterStateUpdated(function (
        Set $set, $state
    ) {
        dd("Don't work :( ");
    })
    ->columnSpanFull()
CylinderType::make('content.cylinder_type.value')
    ->options(array(
        __('users/requests.field.1') => __('users/requests.field.1'),
        __('users/requests.field.2') => __('users/requests.field.2'),
        __('users/requests.field.3') => __('users/requests.field.3')
    ))
    ->hiddenLabel()
    ->afterStateUpdated(function (
        Set $set, $state
    ) {
        dd("Don't work :( ");
    })
    ->columnSpanFull()


The field class (CylinderType.php) :

namespace App\Forms\Components;

use Filament\Forms\Components\Concerns\HasOptions;
use Filament\Forms\Components\Field;

class CylinderType extends Field
{
    use HasOptions;
    protected string $view = 'forms.components.cylinder-type';
}
namespace App\Forms\Components;

use Filament\Forms\Components\Concerns\HasOptions;
use Filament\Forms\Components\Field;

class CylinderType extends Field
{
    use HasOptions;
    protected string $view = 'forms.components.cylinder-type';
}
Solution
state should also be
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }}
state: $wire.{{ $applyStateBindingModifiers("\$entangle('{$getStatePath()}')") }}
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

afterStateUpdated() not running on custom component
FilamentFFilament / ❓┊help
3y ago
afterStateUpdated() Not Triggering in a Custom Filament Field
FilamentFFilament / ❓┊help
2y ago
multiple() select not work with afterStateUpdated
FilamentFFilament / ❓┊help
2y ago