detect the removal of a repeater
I have a billing form with a "repeater" with some fields. I need to calculate and update the value of the field (outside the repeater) "total cost" every time a repeater is removed.
1 Reply
Hello, there's an deleteAction which you can add to the Repeater component. In the deleteAction you return the $action with an ->after method. In this after method you can call your function to calculate the costs. Example below:
Repeater::make('members')
->schema([
// ...
])
->deleteAction(
fn (Action $action) => $action->after(fn() => yourFunction()),
)