F
Filament•10mo ago
dyo

How close filament modal in custom page

<x-filament::modal id='custom-modal-handle'>
<x-slot name='header'>Tambah Nominal</x-slot>
<div>{{ $this->form }}</div>
<x-slot name="actions">
<div class="flex justify-end">
<button type="submit" wire:click='save'>
Simpan
</button>
</div>
</x-slot>
</x-filament::modal>
<x-filament::modal id='custom-modal-handle'>
<x-slot name='header'>Tambah Nominal</x-slot>
<div>{{ $this->form }}</div>
<x-slot name="actions">
<div class="flex justify-end">
<button type="submit" wire:click='save'>
Simpan
</button>
</div>
</x-slot>
</x-filament::modal>
I have this modal form in filament custom page. how can I close the modal when user submit the form?
Solution:
thanks a lot for your response.. that's didn't work for me.. but I tried with this, and it works.. ...
Jump to solution
3 Replies
LeandroFerreira
LeandroFerreira•10mo ago
if you are using LW2
$this->emit('close-modal', ['id' => 'custom-modal-handle']);
$this->emit('close-modal', ['id' => 'custom-modal-handle']);
Solution
dyo
dyo•10mo ago
thanks a lot for your response.. that's didn't work for me.. but I tried with this, and it works..
$this->dispatchBrowserEvent('close-modal', ['id' => 'custom-modal-handle']);
$this->dispatchBrowserEvent('close-modal', ['id' => 'custom-modal-handle']);
awcodes
awcodes•10mo ago
Just so you know, when you update to v3 of filament this will need to be just ->dispatch() 👍 It’s a livewire thing.
Want results from more Discord servers?
Add your server