Is it possible to display a resource create form within a table header Bulk action.
I need to associate multiple resources with another new resource.
For this I have a bulk action in a table that opens up a modal and I can add a form in that action. But I don't know if there is a way to instead of adding the form on the action I can add an already existing create resource form.
I could load the resource form with CreatePage::form(). But that doesn't seem to keep the original resource on the form and instead uses the resource from the table.
Solution:Jump to solution
Move your document form into the model. Make a static function called getForm() and return array.
In your document resources call the getForm()...
5 Replies
If I understand correctly, you have resources A and inside there is a form A and you have resources B but with the click button action it will open the modal and inside the modal it has form A ?
To be more precise. I have a resource "Media" where I store multiple files.
On the table view of this resource I want to select multiple records (Bulk action) and add a button to classify this files under a "Document" resource.
So when I click the bulk action "Classify" with the selected "Media" records, I want to open a modal with the form of the "Document" resource.
Currently I'm adding the form directly on the Bulk Action definition, but I want to use the already existing "Document" form instead of handling two identical forms.
Solution
Move your document form into the model. Make a static function called getForm() and return array.
In your document resources call the getForm()
This worked great. Thanks.