#How do I properly add save button to form?

1 messages · Page 1 of 1 (latest)

keen plume
#

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                Section::make('Sent to existing users when they get added to a new group')
                    ->description('Add User Group')
                    ->schema(
                        collect($this->notification['options'])->map(function ($option) {
                            return RichEditor::make("formData.{$option['slug']}")
                                ->label($option['name'])
                                ->required()
                                ->columnSpanFull();
                        })->toArray()
                    ),
                View::make('filament.pages.components.edit-notification-footer'),
                Action::make('update')
                    ->label('Update')
                    ->requiresConfirmation()
            ]);
    }

This is my form function and I get this 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

How do I properly make a save button for the form? adding Action::make causes an error

tidal ironBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

keen plume
stoic shadow
#

Lmao my brother in christ, what is that form? You've got everything mixed up.

I suggest you go back to the docs because you've confused a lot of things.

FWIW, here is a sample custom page form

<form wire:submit="submit">
    {{ $this->form }}

    <x-primary-button type="submit" class="mt-4 relative">
        {{__('Save')}}
    </x-primary-button>
</form>
#

Also, to get rid of the error, change your form to this

public function form(Form $form): Form
{
return $form
    ->schema([
        Section::make('Sent to existing users when they get added to a new group')
            ->description('Add User Group')
            ->schema(
                collect($this->notification['options'])->map(function ($option) {
                    return RichEditor::make("formData.{$option['slug']}")
                        ->label($option['name'])
                        ->required()
                        ->columnSpanFull();
                })->toArray()
            ),
    ]);
}
keen plume
stoic shadow
keen plume
stoic shadow
keen plume
#

sometimes I see this <x-filament::section> and get confused with this one why others have -panels>