F
Filament14mo ago
Thijmen

Action in Form

I've copied this code from the docs but am getting a error. I've tried to switch action classes but that doesnt solve it https://filamentphp.com/docs/3.x/forms/actions#defining-a-form-component-action
\Filament\Forms\Components\Actions\Action::make('resetStars')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function () {

}),
\Filament\Forms\Components\Actions\Action::make('resetStars')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function () {

}),
Error:
Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, Filament\Forms\Components\Actions\Action given
Filament\Forms\ComponentContainer::Filament\Forms\Concerns\{closure}(): Argument #1 ($component) must be of type Filament\Forms\Components\Component, Filament\Forms\Components\Actions\Action given
3 Replies
Thijmen
ThijmenOP14mo ago
Doing the action code in a suffixAction works. But i thought that you could do action in a form without input? Using it inside a Actions::make() does work
Saade
Saade14mo ago
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make()
])
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make()
])
Thijmen
ThijmenOP14mo ago
Yeah exactly that works. Based on the text in docs i thought you could do it without Actions::make()
Want results from more Discord servers?
Add your server