BeforeValidation addError on Wizard Step with repeater

Hi,

I'm using the Filament\Forms seperated from admin panel.

I'm trying to add additional verification on a step component. This step component contains a repeater leaves that has items in it.

I'm trying to add an error on the step. I don't know what I'm doing wrong.
I'd appreciate if anyone could help.

Also my form data is stored in
public array $data;

Forms\Components\Wizard\Step::make('absence(s)')

 ->beforeValidation(function (array $state, CreateLeaveForm $livewire, Forms\Components\Wizard\Step $component) {


foreach ($state['leaves'] as $key => $leave) {
    $livewire->addError("leaves.$key.from_date", 'An error message here.');
}

});
Was this page helpful?