F
Filament14mo ago
cpbret

Create Another in a Form Action

The button shows a modal, shows the Create Another button, but calling ->halt prevents the parent data from updating. Hitting Create updates my component correctly. I cannot find a way to do this.
6 Replies
cpbret
cpbretOP14mo ago
No description
Patrick Boivin
Patrick Boivin14mo ago
I don't understand, why do you need halt() in this context?
cpbret
cpbretOP14mo ago
Because the modal closes if I do not. I'm trying to use replicate Create Another functionality on a Form/Component/Action Action chaining and the Create another shown in documentation work.. but Action and Form/Action are not 1-1
cpbret
cpbretOP14mo ago
Looks like I have a similar problem with the standard action. The modal either closes, I can't reset the modal form, or I can't dispatch and refresh the parent form. What should the guts be for "// Reset the form and don't close the modal" https://filamentphp.com/docs/3.x/actions/modals#adding-an-extra-modal-action-button-to-the-footer
Patrick Boivin
Patrick Boivin14mo ago
I think the action() part is meant to close the modal... but you're on the right path with dispatch() though. Can you instead let the modal close and in the event handler, trigger a new modal for the "create another" action?
awcodes
awcodes14mo ago
Have a look here to see how Filament does it with the tables create action. https://github.com/filamentphp/filament/blob/3.x/packages/tables/src/Actions/CreateAction.php
GitHub
filament/packages/tables/src/Actions/CreateAction.php at 3.x · fila...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
Want results from more Discord servers?
Add your server