© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
3 replies
malebestia.

livewire component with event in form

hello everyone,
I have inserted inside my form, a select and a livewire component that simply has to display a blade with data (html and css), which should update when the state of the select changes

->form([
    Select::make('rating_id')
    ->prefix('Your choise')
    ->hiddenLabel()
    ->options($this->array_opts)
    ->required()
    ->reactive()
    ->afterStateUpdated(function (?string $state, ?string $old) {
        $this->dispatch('my_event', rating_id: $state);
    }),
    Livewire::make(MyComponent::class, ['article_uuid' => $this->article_uuid, 'rating_id' => $this-  >rating_id]),
])
->form([
    Select::make('rating_id')
    ->prefix('Your choise')
    ->hiddenLabel()
    ->options($this->array_opts)
    ->required()
    ->reactive()
    ->afterStateUpdated(function (?string $state, ?string $old) {
        $this->dispatch('my_event', rating_id: $state);
    }),
    Livewire::make(MyComponent::class, ['article_uuid' => $this->article_uuid, 'rating_id' => $this-  >rating_id]),
])

to update the data of the MyComponent component I thought of using in the select afterStateUpdated $this->dispatch and in my livewire component
#[On('my_event')]
public function doSomething(string $rating_id): array
{
    dd('ok');
    //do something
}
#[On('my_event')]
public function doSomething(string $rating_id): array
{
    dd('ok');
    //do something
}

but it seems that the event is not listened, what am I doing wrong?
thanks in advance
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Livewire component in form
FilamentFFilament / ❓┊help
2y ago
Livewire component event
FilamentFFilament / ❓┊help
3y ago
Form validation in Livewire component
FilamentFFilament / ❓┊help
3y ago
Livewire Form Component problem
FilamentFFilament / ❓┊help
13mo ago