Modal Action in Form with Table Modal Body
Hey everyone, I have a complex issue with my selection dialog. I hope I can explain it in 3 steps:
1) I have an action button in a form, that opens a modal. This Modal contains a custom table via table builder to select a record, that should be used to pre-fill the form.
2) For this, each table record, has a "Select" button. Clicking on this button dispatches an event to pass the data down to the form.
3) The problem: The event is dispatched (can see it in Debug bar), but it does not reach the form or any function outside the Livewire class.
The form:
The modal action
11 Replies
The table (Livewire component)


yes, because you need to define the
onFooBar
in the Livewire component
Did that fix the issue?can you explain more please? thx!
sorry, explain what? SelectProductTable is a livewire component
https://livewire.laravel.com/docs/events
Laravel
Events | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
@LeandroFerreira SelectProductTable is of course a Livewire component
Sorry, I didn't understand your question
in short:
#[On('fooBarEvent')]
does not work in any component function thats not inside class SelectProductTable extends \Livewire\Component
, where public function table() ...
is dispatching the event.
Where I want it to work: class SelectProductAction extends Action ... public function onFooBar()
, but I see now a Filament Action is not a Livewire component, is it ?https://github.com/elmudometal/filament-select-table/
I went through the same thing and solved it the way I did in this package.
You can make it easier if you set up a livewire with a repeater instead of a table.
GitHub
GitHub - elmudometal/filament-select-table
Contribute to elmudometal/filament-select-table development by creating an account on GitHub.
yes. Take a look: https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component
You can add an action to a Livewire component, but the event must be defined within the component itself
In the end, I fixed it by creating a custom FormField instead of an Action 🙂