F
Filament16mo 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
Patrick Boivin16mo ago
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
xyOP16mo ago
Ok, will try that. And what about opening a modal at the end of the createaction?
Patrick Boivin
Patrick Boivin16mo ago
Do you mean showing a modal when the user lands on the Create page?
xy
xyOP16mo ago
Yes, either showing a modal when the user lands or when the user presses the create button. Ideally both
Patrick Boivin
Patrick Boivin16mo ago
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.
Want results from more Discord servers?
Add your server