FilamentF
Filament3y ago
John

Form Wizard save on every next step

I want to save the current step (or the complete form for that matter) every "Next step".

I've created a CustomWizard, extending the base Wizard.

In my version of this part:
https://github.com/filamentphp/forms/blob/2.x/src/Components/Wizard.php#L45

I added this:
$component->getRecord()->update($component->getState());

That saves the complete record to the database. Which is cool. But...

When I add in a select that's just for filtering another select, $component->getState() misses the ->dehydrated(false) on the "dummy" select.

I've noticed that the component uses \Filament\Forms\Components\Concerns\HasState::getState, which doesn't care about dehydration. And EditRecord uses \Filament\Forms\Concerns\HasState::getState, which does.

How can I save the Wizard Step form, or the complete Wizard, taking ->dehydrated() into account?
Was this page helpful?