© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
orelyus

Saving forms data to resource

I'm kind of lost. I made a form outside filament and placed it on the landing page. How do I save it in a filament resource when the user hits submit?

ContactForm.php
<?php

namespace App\Livewire;

...

class ContactForm extends Component implements HasForms
{
    use InteractsWithForms;

    public $email;
    public $first_name;
    public $last_name;
    public $phone;
    public $message;
    public $comm_method;

    protected function getFormSchema(): array
    {
        return [
            Grid::make(2)
                ->schema([
                    TextInput::make('first_name')->required(),
                    TextInput::make('last_name')->required(),
                    TextInput::make('email')->required(),
                    TextInput::make('phone'),
                    Textarea::make('message')
                        ->rows(5)
                        ->cols(20)
                        ->columnSpan('full')
                        ->maxLength(4000),
                    Radio::make('comm_method')
                        ->label("Preferred Communication Method")
                        ->options([
                            'email' => 'Email',
                            'messenger' => 'Messenger',
                            'viber' => 'Viber',
                            'whatsapp' => 'Whatsapp',
                        ])
                        ->columnSpan('full'),
                ]),

        ];
    }
    public function create(): void
    {
        dd($this->form->getState());
    }


    public function render()
    {
        return view('livewire.contact-form');
    }
}
<?php

namespace App\Livewire;

...

class ContactForm extends Component implements HasForms
{
    use InteractsWithForms;

    public $email;
    public $first_name;
    public $last_name;
    public $phone;
    public $message;
    public $comm_method;

    protected function getFormSchema(): array
    {
        return [
            Grid::make(2)
                ->schema([
                    TextInput::make('first_name')->required(),
                    TextInput::make('last_name')->required(),
                    TextInput::make('email')->required(),
                    TextInput::make('phone'),
                    Textarea::make('message')
                        ->rows(5)
                        ->cols(20)
                        ->columnSpan('full')
                        ->maxLength(4000),
                    Radio::make('comm_method')
                        ->label("Preferred Communication Method")
                        ->options([
                            'email' => 'Email',
                            'messenger' => 'Messenger',
                            'viber' => 'Viber',
                            'whatsapp' => 'Whatsapp',
                        ])
                        ->columnSpan('full'),
                ]),

        ];
    }
    public function create(): void
    {
        dd($this->form->getState());
    }


    public function render()
    {
        return view('livewire.contact-form');
    }
}
Solution
You have a create method so just create new record there as you would without filament
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Required "Select" forms component saving empty data.
FilamentFFilament / ❓┊help
3y ago
two forms data from one resource to another...
FilamentFFilament / ❓┊help
3y ago
Saving resource when executing Action
FilamentFFilament / ❓┊help
12mo ago
passing data between forms
FilamentFFilament / ❓┊help
14mo ago