F
Filamentβ€’2w ago
igmltd

Call getFormActions() in section?

I moved the form actions (save changes & cancel) to a Section "footerActions" by copying the actions from the getSaveFormAction() and getCancelFormAction() methods found in Filament\Resources\Pages\EditRecord; Code below, feels abit hacky to me - just wondering if theres a way to call it and return it directly from getFormActions() or something? Is there a a better way? public static function form(Form $form): Form { return $form->schema([ Section::make('Member City ') ->columns(2) ->schema([ Forms\Components\TextInput::make('name') ->required() ->maxLength(50), ])->footerActions([ Action::make('save') ->label(__('filament-panels::resources/pages/edit-record.form.actions.save.label')) ->submit('save') ->keyBindings(['mod+s']), Action::make('cancel') ->label(__('filament-panels::resources/pages/edit-record.form.actions.cancel.label')) ->alpineClickHandler('document.referrer ? window.history.back() : window.location = "/admin/fellow"') ->color('gray') ] ) ]); }
3 Replies
igmltd
igmltdβ€’2w ago
Is my approach correct? Anyone? πŸ™
LeandroFerreira
LeandroFerreiraβ€’2w ago
I think so
igmltd
igmltdβ€’6d ago
It works ok, so i guess that confirms it! πŸ˜‰