F
Filamentβ€’2mo ago
Mugi

How to avoid form opening again after confirming an action

Hello, after adding a delete button in the edit form of my column, when I confirm the delete, the form reopens automatically. The problem is that since the column has been deleted, this causes an error. I tried the ->before() method to be able to cancel the action if the column doesn't exist, without success. Does anyone have an idea how to avoid this? Thanks and sorry if it was something obvious, I tried finding other ways to achieve this without success
17 Replies
Mugi
Mugiβ€’2mo ago
I tried like this, but nothing has changed
No description
Mugi
Mugiβ€’2mo ago
I think I will have to put directly the delete button on the column because I tried a lot of things and nothing worked for me
Mugi
Mugiβ€’2mo ago
I tried that too but I can't use this in this case because I'm not working with Modals but with EditAction
Mugi
Mugiβ€’2mo ago
No description
LeandroFerreira
LeandroFerreiraβ€’2mo ago
Tables\Actions\EditAction::make()
->form(...)
->extraModalFooterActions([
Tables\Actions\Action::make('customDelete')
->requiresConfirmation()
->action(fn (Exercise $record) => $record->delete())
->cancelParentActions()
])
Tables\Actions\EditAction::make()
->form(...)
->extraModalFooterActions([
Tables\Actions\Action::make('customDelete')
->requiresConfirmation()
->action(fn (Exercise $record) => $record->delete())
->cancelParentActions()
])
Mugi
Mugiβ€’2mo ago
Oh my god that's my bad for this one, I'm new to filament and I didn't realise I had to use Tables\Actions\Action. Thank you very much for you help, it worked ! I have one last question, without wanting to disturb you too much. I'd been trying to find a way to do this for a long time too, but I'd finally given up. I was looking for a way to move the checkbox for bulkActions to the top right of the card. I just wanted to know if you thought this was possible and if you had any clues?
Mugi
Mugiβ€’2mo ago
No description
LeandroFerreira
LeandroFerreiraβ€’2mo ago
hum.. if you can't customize it using css, I think you need to publish and customize this view, but we don't recommend this https://filamentphp.com/docs/3.x/support/style-customization#publishing-blade-views
Mugi
Mugiβ€’2mo ago
I think I can customize it with css because I managed to do it directly with the html editor of my browser by adding position: absolute and some other attributes, but I didn't find how to add this custom css to my app directly
Mugi
Mugiβ€’2mo ago
oh I see, and this css file will be here on top of the original one right ? So I just have to add css for the checkbox element in it without other things
LeandroFerreira
LeandroFerreiraβ€’2mo ago
yes
Mugi
Mugiβ€’2mo ago
I'll try that rn thanks for the help, also I assume that I will have to do something like this : .fi-checkbox-input{...} as it is its name ?
No description
LeandroFerreira
LeandroFerreiraβ€’2mo ago
yes, something like this πŸ‘†
Mugi
Mugiβ€’2mo ago
tysm this worked, you saved me ngl 😭 thanks for what you're doing !