F
Filament2y ago
G3z

Is it possible to add conditional confirmation on the save action ?

I tried the following in my EditPage subclass to ask for confirmation on a set condition but the callback inside requiresConfirmation is never called
protected function getSaveFormAction(): Action
{
return Action::make('save')
->label(__('filament::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s'])
->requiresConfirmation(function ($data) {
if (false == empty($data['agreed_price'])) {
if ($data['agreed_price'] != $data['sell_total_eur_gross']) {
return true;
}
}

return false;
});
}
protected function getSaveFormAction(): Action
{
return Action::make('save')
->label(__('filament::resources/pages/edit-record.form.actions.save.label'))
->submit('save')
->keyBindings(['mod+s'])
->requiresConfirmation(function ($data) {
if (false == empty($data['agreed_price'])) {
if ($data['agreed_price'] != $data['sell_total_eur_gross']) {
return true;
}
}

return false;
});
}
1 Reply
G3z
G3zOP2y ago
il use a custom validation on sell_total_eur_gross as workaroud
Want results from more Discord servers?
Add your server