Handle the creation process for a wizard form
I've created a form with a Wizard but it doesn't 100% reflect the structure of my DB. For example, I have a fairly complex repeater for creating products, and I'd like to store the field values in a Json in my “products” table. Where I'm stuck is that I have no idea how to intercept the form's submit in order to process the data myself and insert it into my DB.
So I created a submit action button using this method: https://filamentphp.com/docs/3.x/forms/layout/wizard#rendering-a-submit-button-on-the-last-step
And then what do I do to process the submit?
I found this: https://filamentphp.com/docs/3.x/panels/resources/creating-records#customizing-the-creation-process in the documentation.
I've added the method to my resource file, but it doesn't seem to be called when I click on the "submit" button.
Is there a particular method to use when on a Wizard? I can't find much
Thanks in advance 😇
Solution:Jump to solution
handleRecordCreation
is available in the CreatePage.php, not the resource class5 Replies
If you are using a resource, you should do this
https://filamentphp.com/docs/3.x/panels/resources/creating-records#using-a-wizard
Ah uh, sorry... When I mentioned my resource file, I meant the one at the root of app/Filament (in my case: RequestResource.php). I use the standard form() function.
Solution
handleRecordCreation
is available in the CreatePage.php, not the resource classAh ok, I feel like an idiot... 🫥 Well, problem solved 😎
Thanks a lot for your time!
Thanks a lot for your time!
You aren't an idiot, it is just a detail 👍