F
Filament11mo ago
dasK_

Adding an Action to a Form Section?

Have been trying to add an action to form sections but have been unsuccessful, any solutions? protected function getFormSchema(): array { return ([ Section::make('Modify Balance') ->schema([ TextInput::make('bal_subscriberId')->label('Subscriber ID'), TextInput::make('bal_amount')->label('Amount'), Checkbox::make('bal_setBalance')->label('Set Balance'), TextArea::make('bal_description')->label('Description'), ]), Action::make('updateBalance') ->label('Update Balance') ->action('updateBalance'), Section::make('Modify Package Limits') ->schema([ TextInput::make('limit_packageId')->label('Package ID'), TextInput::make('limit_dataBytes')->label('Data Bytes (in bytes)'), TextInput::make('limit_moCalls')->label('MO Calls (in seconds)'), TextInput::make('limit_mtCalls')->label('MT Calls (in seconds)'), TextInput::make('limit_moSms')->label('MO SMS'), TextInput::make('limit_mtSms')->label('MT SMS'), TextArea::make('limit_comment')->label('Comment'), ]), Action::make('modifyPackageLimits') ->label('Modify Package Limits') ->action('modifyPackageLimits')
Solution:
Run composer about and see what filament version you are on. You may be on a version before that was introduced.
Jump to solution
4 Replies
dasK_
dasK_OP11mo ago
I saw that, but I was not able to get \Components\Actions to work Class "Filament\Forms\Components\Actions" not found use Filament\Forms\Components\Actions; use Filament\Forms\Components\Actions\Action; Section::make('Modify Balance') ->schema([ TextInput::make('bal_subscriberId')->label('Subscriber ID'), TextInput::make('bal_amount')->label('Amount'), Checkbox::make('bal_setBalance')->label('Set Balance'), TextArea::make('bal_description')->label('Description'), ]), Actions::make([ Action::make('updateBalance') ->label('Update Balance') ->action('updateBalance') ]),
Solution
awcodes
awcodes11mo ago
Run composer about and see what filament version you are on. You may be on a version before that was introduced.
dasK_
dasK_OP11mo ago
ugh, I literally just installed filament for the first time last week, how did i install 2.17.55.. worked few some bugs with the newly updated methods, all good now! Thank you!
Want results from more Discord servers?
Add your server