© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
13 replies
btx

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:

Tabs\Tab::make('Import')->schema([
   Actions::make([
      SelectProductAction::make('select_product'),

      SelectShippingAction::make('select_shipping'),
   ]),
]),
Tabs\Tab::make('Import')->schema([
   Actions::make([
      SelectProductAction::make('select_product'),

      SelectShippingAction::make('select_shipping'),
   ]),
]),


The modal action

class SelectProductAction extends Action {
   public static function getDefaultName(): ?string {
      return 'selectProductAction';
   }

   protected function setUp(): void {
      parent::setUp();

      $this->label('Select Product');
      $this->modalHeading('Select Product');
      $this->modalSubmitAction(false);
      $this->modalCancelAction(false);
      $this->modalFooterActions([]);
      $this->modalContent(function (SelectProductAction $action): View {
         return view('filament.actions.select-product-modal-content', [
            'selectProductTable' => SelectProductTable::class,
         ]);
      });
      $this->action(fn ($data, $value, $state) => dd($data, $value, $state));
   }

   #[On('fooBarEvent')]
   public function onFooBar($data): void {
      // DOES NOT RECEIVE THE EVENT !
      dd("On fooBarEvent", $data);
   }
}
class SelectProductAction extends Action {
   public static function getDefaultName(): ?string {
      return 'selectProductAction';
   }

   protected function setUp(): void {
      parent::setUp();

      $this->label('Select Product');
      $this->modalHeading('Select Product');
      $this->modalSubmitAction(false);
      $this->modalCancelAction(false);
      $this->modalFooterActions([]);
      $this->modalContent(function (SelectProductAction $action): View {
         return view('filament.actions.select-product-modal-content', [
            'selectProductTable' => SelectProductTable::class,
         ]);
      });
      $this->action(fn ($data, $value, $state) => dd($data, $value, $state));
   }

   #[On('fooBarEvent')]
   public function onFooBar($data): void {
      // DOES NOT RECEIVE THE EVENT !
      dd("On fooBarEvent", $data);
   }
}
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

table action modal form refresh?
FilamentFFilament / ❓┊help
2y ago
Modal action or table inside form
FilamentFFilament / ❓┊help
2y ago
table action modal
FilamentFFilament / ❓┊help
3y ago
Testing Table Action with modal
FilamentFFilament / ❓┊help
3y ago