F
Filament2y ago
xy

Open modal before create action

Is it possible to : 1) open a modal with fields when initially pressing the create resource button? The idea for this is to take in some contextual information (choosing a template for the form). 2) open a modal when form is submitted on create resource page before the resource is created. There will be an option on the modal to create a different resource upon creation. I want to use the option to create a different resource.
5 Replies
Patrick Boivin
Yes, I think you could use a regular action instead of CreateAction. Take the information you need in the action modal and save it in the session. Then redirect to your full Create page and fetch the data from the session in mount().
xy
xyOP2y ago
Ok, will try that. And what about opening a modal at the end of the createaction?
Patrick Boivin
Do you mean showing a modal when the user lands on the Create page?
xy
xyOP2y ago
Yes, either showing a modal when the user lands or when the user presses the create button. Ideally both
Patrick Boivin
Ok. What I'm suggesting above is pretty much this (you can make the Action label say "New item"). If you want to show the modal when the Create page loads, I think you could do it with a hidden Form action, maybe. I'm not sure.

Did you find this page helpful?