© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
Gustavo

Can't create custom page with multiple forms

I'm creating a custom page and so far it has been working correctly, but now I found a problem that doesn't make any sense to me.

This custom page has two forms in it. Following the documentation about adding forms to livewire components: https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component#using-multiple-forms

I implemented the
HasForms
HasForms
interface and used the
InteractsWithForms
InteractsWithForms
on the custom page class
use Filament\Pages\Page;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;

class Kanban extends Page implements HasForms
{
    use InteractsWithForms;
use Filament\Pages\Page;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;

class Kanban extends Page implements HasForms
{
    use InteractsWithForms;


I initialized both forms data as an empty array
public ?array $formHoursData = [];
public ?array $formDeclinedData = [];
public ?array $formHoursData = [];
public ?array $formDeclinedData = [];


I defined a
getForms()
getForms()
function returning an array with both forms names
protected function getForms(): array
{
    return [
        'formHours',
        'formDeclined',
    ];
}
protected function getForms(): array
{
    return [
        'formHours',
        'formDeclined',
    ];
}


I defined both functions that define each form
use Filament\Forms\Form;

public function formHours(Form $form): Form
{
    // form definition here
}

public function formDeclined(Form $form): Form
{
    // form definition here
}
use Filament\Forms\Form;

public function formHours(Form $form): Form
{
    // form definition here
}

public function formDeclined(Form $form): Form
{
    // form definition here
}


And lastly I filled both forms on the
mount()
mount()
function
public function mount()
{
    $this->formHours->fill();
    $this->formDeclined->fill();
}
public function mount()
{
    $this->formHours->fill();
    $this->formDeclined->fill();
}


After all this, somehow when I open the page, I get the error
App\Filament\Pages\Kanban::formHours(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given
App\Filament\Pages\Kanban::formHours(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given
which happens when filament tries to run the form definition function.

Did I do something wrong? Why isn't it working? Since the page class is implementing the
HasForms
HasForms
interface and the
InteractsWithForms
InteractsWithForms
trait, why is Filament trying to feed an Infolist to the form definition function?
Adding a form to a Livewire component - Form Builder - Filament
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

Multiple forms in custom page
FilamentFFilament / ❓┊help
3y ago
Multiple forms on custom page
FilamentFFilament / ❓┊help
3y ago
Multiple forms page
FilamentFFilament / ❓┊help
2y ago
Page with multiple forms action
FilamentFFilament / ❓┊help
3y ago