FilamentF
Filament3y ago
Niek

Form Wizard with dynamic enabled/disabled submit button

I have a Filament Resource Form for creating a record.
This Form contains a Wizard with a few steps.
In the last step I need the submit button only to be enabled if a checkbox is checked.

I use the function getSubmitFormAction():

public function getSubmitFormAction(): \Filament\Actions\Action
{
return parent::getSubmitFormAction()
->disabled(function (Forms\get $get) {
return $get('confirm') == false;
});
}

Apparently this does not work:
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization

This makes sense to me, but how do I achieve the submit button to be enabled only if the checkbox is checked?

Any help would be very appreciated
Solution
make sure the checkbox is live()
Was this page helpful?