Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given
It's been a few months since I've done any Filament dev work and I'm back in it and running into this error when trying to add a form to a Page class. I feel like I've run into this before and it was some little quirk that was causing the issue.
in my view I'm doing
{{ $this->form }}
I feel like I'm doing everything right, but I can't seem to figure out what's going on.1 Reply
The error message is
form(): Argument #1 ($form) must be of type Filament\Forms\Form, Filament\Infolists\Infolist given
There's not much else going on in this page class. I do have a modal action with a form in it, but I don't recall that interfering with another form outside of an action. I feel like when I've run into this in the past it was because I had multiple forms and wasn't using the getForms() method, but I've tried that as well and still seeing the error.
Ok, after all that I started commenting stuff out, and it was because my form field used ->default($this->getDefaultValue) , this fixed it: ->default(fn() => $this->getDefaultValue())