Keep create action modal open on success with feedback

Is it somehow possible to keep the modal of a create action open after the record has been created? I'd like to show the feedback with some data which shouldn't be available to the user when they close the modal after creating a record. Thanks in advance!
14 Replies
toeknee
toeknee8mo ago
Not out of the box, you could alter the create action to a normal action, with a wizard, which is submit, then feedback?
Laurens
Laurens8mo ago
Should the final step then show feedback? As chaining ->using(function (array $data) after the final step also just closes the wizard 🤔
toeknee
toeknee8mo ago
So you would need to use ->AfterStepUpdated() and on the 2nd to final step of the wizard and the save it, and just have a close / dismiss or the final submit is to action the feedback 😉
Laurens
Laurens8mo ago
AfterStepUpdated doesn't seem to exist here. I've found afterValidation but it doesn't seem to get called. What could be happening here?
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->columns()
->afterValidation(function ($data) {
dd($data);
}),
])
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->columns()
->afterValidation(function ($data) {
dd($data);
}),
])
there isn't a difference due to this being inside the Manage page of a "simple" resource right?
Quin.
Quin.8mo ago
There are no errors also?
Laurens
Laurens8mo ago
with the code above the Action::make() just closes without an exception This is on Filament v3.0.96 & Laravel v10.32.1
toeknee
toeknee8mo ago
Because you have not defined an action.
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->columns()
->afterValidation(function ($data) {
dd($data);
}),
])
->action(fn($data) => dd($data))
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->columns()
->afterValidation(function ($data) {
dd($data);
}),
])
->action(fn($data) => dd($data))
Laurens
Laurens8mo ago
The data being dumped there for me is from the action though, afterValidation still doesn't run if I change the dd in action to 'action', its the string and not the array of data 🙂 Same result in a default resource, so it's not because of the simple resource at least 🤔
toeknee
toeknee8mo ago
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->afterValidation(function (Closure $get, $set) {
dd($get('name'));
}),
])
->action(fn($data) => dd($data))
Actions\Action::make('create')
->steps([
Step::make('Name')
->description('Give the category a unique name')
->schema([
TextInput::make('name')->required(),
])
->afterValidation(function (Closure $get, $set) {
dd($get('name'));
}),
])
->action(fn($data) => dd($data))
Laurens
Laurens8mo ago
Did it work for you locally? Because here I'm always only getting the dump from the action, never from after validation 🤔 Mine sits in getHeaderActions of a Manage page inside a Simple resource
toeknee
toeknee8mo ago
It does on V2.... but on a column action
Laurens
Laurens8mo ago
Seems to be no longer working on V3 then 😦 We also had quite a few translation issues which worked on V2 but all broke in V3. Will probably have to figure out custom components then like plugins I guess
toeknee
toeknee8mo ago
The code is there for it to run, so I'd say to try and look into it more Can you check what filament version you are on? php artisan about
Laurens
Laurens8mo ago
This is on Filament v3.0.96 & Laravel v10.32.1 🙂