F
Filamentβ€’17mo ago
mtzdev

Auto save form

Hey guys πŸ‘‹ , in our legacy system we have the following functionality: when the user enters a form, he already creates a record in the database with the status of "Draft", and so the user can leave and finish sending later, the status only changes when sending through the submit button. How could I develop this same functionality in Filament? In pure PHP we use jquery and AJAX, but in Laravel I got a little lost. If anyone can help me with this part I would be very grateful. 🀟
4 Replies
Yuut4
Yuut4β€’17mo ago
try to see if this helps https://filamentphp.com/docs/2.x/admin/resources/creating-records and go to #Lifecycle hooks
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Yuut4
Yuut4β€’17mo ago
you can use the before to do this action I think basically before opening the form it can create a record, then you can use the beforefill I think to show the data filled in according to the previously created
toeknee
toekneeβ€’17mo ago
You can run the function afterValidated
Saade
Saadeβ€’17mo ago
You can use lifecycle hooks for that. Hook into beforeFill hook on the create page, create your record, then $this->redirect(static::getResource()::getUrl('edit', ['record' => $record])
Want results from more Discord servers?
Add your server