FilamentF
Filament3y ago
John

Custom Wizard layout component

(This is a follow up on ❓┊helpForm Wizard styling)

I'm trying to create and use my custom layout component \App\Forms\Components\Wizard by extending \Filament\Forms\Components\Wizard.
  • The layout is different (steps are displayed vertically)
  • I want to save the form at every [Next >] / [< Previous]
I'm struggling with where/how to use my Widget class instead of the package one.
The only place I could find where the Widget class is actually used is in \Filament\Resources\Form::getSchema. Does that mean that I need my custom Form class as well? After that I get lost in a web of inheritance in traits of which I don't know which I need overriding and how.

I then tried to simply return my \App\Forms\Components\Wizard in \App\Filament\Resources\RequestResource\Pages\EditRequest::getFormSchema. It gets rendered as flat form fields, without a Widget "around" it. Then I took the wizard.blade.php from Filament. I do get my Widget rendered now!

But, the [Next >] button (and perhaps more?) doesn't work. A LiveWire POST is fired with 200 OK response, no console errors, but my Wizard stays at the first step. The Filament Wizard hits the wizard::nextStep listener in vendor/filament/forms/src/Components/Wizard.php:45 but my custom Wizard does not.

  1. Do I need a custom Form class, HasWizard traits etc. to get this working properly?
  2. Why is the [Next >] button not working and how can I fix it?
Was this page helpful?