How to return the Wizard to step 1 after create success in custom page.

Hello, I have created a custom page using the form following schema this form saves the data into external API.
Wizard::make([
Wizard\Step::make('Order')
->schema([
// ...
]),
Wizard\Step::make('Delivery')
->schema([
// ...
]),
Wizard\Step::make('Billing')
->schema([
// ...
]),
])
Wizard::make([
Wizard\Step::make('Order')
->schema([
// ...
]),
Wizard\Step::make('Delivery')
->schema([
// ...
]),
Wizard\Step::make('Billing')
->schema([
// ...
]),
])
Everything is good, But after the creation successfully I'm using $this->form->fill() this method clears the data but doesn't reset the wizard to the first step. Any Idea? Best Regards.
3 Replies
bennett
bennett7mo ago
I'm also having trouble with this. There doesn't seem to be an event listener you can hook into, and nothing sticks out to me in Wizard.php as an easy way to do this. Calling $this->reset() in my component doesn't make the Wizard step reset to 1. I was able to accomplish this by placing a listener in Filament rendered HTML: new HtmlString('<div x-on:reset-step.window="step = \'vendors\'"></div>') Obviously you could do this within a label, placeholder, etc. Just note that step is the Alpine variable representing the current step. Lastly you just dispatch reset-step from your Livewire component.
toeknee
toeknee7mo ago
Nice work, maybe a filament tip would be good
LeandroFerreira
LeandroFerreira7mo ago
GitHub
How to return the Wizard to step 1 after create success in custom p...
Package Form builder Package Version v3 How can we help you? Hello, I have created a custom page using the form following schema this form saves the data into external API. Wizard::make([ Wizard\St...
Want results from more Discord servers?
Add your server