Tables\Actions\Action::make("add")
->label("Add Segment")
->icon("heroicon-m-plus")
->modalSubmitActionLabel("Save")
->extraModalFooterActions(fn (Tables\Actions\Action $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label("Save and add another"),
])
->closeModalByClickingAway(false)
->form(SegmentForm::getForm())
->action(function(array $data, array $arguments, Tables\Actions\Action $action, Forms\Set $set){
// .. The action
if($arguments['another'] ?? false){
// How to reset the form?
// Have tried these combinations
$action->resetFormData();
// Tried with an empty array and with all the fields with "empty" states
$action->formData([
"type" => "" // also tried null
]);
$action->fillForm([
"type" => "" // also tried null
]);
// Also tried $set
$set("type", null);
// Stopping the modal from closing
$action->halt();
}
}),
Tables\Actions\Action::make("add")
->label("Add Segment")
->icon("heroicon-m-plus")
->modalSubmitActionLabel("Save")
->extraModalFooterActions(fn (Tables\Actions\Action $action): array => [
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
->label("Save and add another"),
])
->closeModalByClickingAway(false)
->form(SegmentForm::getForm())
->action(function(array $data, array $arguments, Tables\Actions\Action $action, Forms\Set $set){
// .. The action
if($arguments['another'] ?? false){
// How to reset the form?
// Have tried these combinations
$action->resetFormData();
// Tried with an empty array and with all the fields with "empty" states
$action->formData([
"type" => "" // also tried null
]);
$action->fillForm([
"type" => "" // also tried null
]);
// Also tried $set
$set("type", null);
// Stopping the modal from closing
$action->halt();
}
}),