© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
Mansoor Khan

Open a Modal when field state changes

Is it possible to open a modal when the field state changes. I need to add something like this to the Toggle field using a Macro.

Toggle::make('is_published')
  ->requiresConfirmation(),
Toggle::make('is_published')
  ->requiresConfirmation(),


Has anyone tried something, any trick?

We could dispatch the
open-modal
open-modal
event but then we also need to register it somewhere and should be able to cancel/proceed the toggle state.

Toggle::make('is_published')
  ->live()
  ->afterStateUpdated(function (Component $livewire) {
    $livewire->dispatch('open-modal', 'modal-id');
  }),
Toggle::make('is_published')
  ->live()
  ->afterStateUpdated(function (Component $livewire) {
    $livewire->dispatch('open-modal', 'modal-id');
  }),
Solution
You can try something like
$livewire->mountFormComponentAction()
$livewire->mountFormComponentAction()
or sth
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

open modal custom field
FilamentFFilament / ❓┊help
2y ago
Custom field Open Modal Form
FilamentFFilament / ❓┊help
3y ago
open modal inside a modal
FilamentFFilament / ❓┊help
3y ago
State of a modal
FilamentFFilament / ❓┊help
14mo ago