AttachAction in relationManager
I have a question about a situation I'm encoutring on my project. I have a PartnersRelationManager into my projectResource, I'm using create action if there are no partners to attach and then I show the attach btn. But what I really want, is to add a create btn in the attachAction, so I can create a new partner if I didn't find the exact partner to attach from the select list.
Any ideas??
Thank you
Solution:Jump to solution
```php
->headerActions([
Tables\Actions\AttachAction::make()
->preloadRecordSelect() // Preload the select field values
->recordSelect(fn (Select $select) => $select->placeholder(__('projProgRelations.choosePartner'))) // change the select placeholder text...
13 Replies
I used this code an I got the following screenshots
->extraModalFooterActions()
and place your creation action in here.
Then you can create if you can't find one in search.
And without using the whole code under the recordSelect(...) ?
Hello, can you please give me more details because I couldn't make it work.
very rough quickfreehand code
I used Filament\Tables\Actions\Action (which is working) because the Filament\Forms\Components\Actions\Action produces an error of instantiation must to be done first then I can proceed. The problem here is when I click on "soumettre" btn nothing happend, no error and no database record insertion done. It's like it's not submitted,
Any ideas?
try: ->formForm([]) on the action
here is my code
I didn't get any result on the docs about this method
Place it:
just to test if nothing happens, then on the Partner dd() it to see if ti's being hit.
I tried to dd the data in the action function but nothing showed up, and I also tried to log some text there, but nothing logged.
do you mean to place form( .... ) by fillForm(....)?
try changing create to create_partner
No i did not
@toeknee
Here is the final solution :
You can acheive it without the ->form(....) but if you want to control the creation form, it's good to use it.
Solution