Add additional callbacks for wizard steps #17429
lukas-frey
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
How about allowing you to inject a |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Issue
Currently, wizard steps only have a beforeValidation() and afterValidation() step.
However, in my case for example, I have a quite complex Wizard with conditional steps (I conditionally hide steps that are not needed, based on what the user has filled out in the previous steps).
This means, that I can not rely on the order of the steps: sometimes step 3 follows immediately after step 2, but if step 2 is hidden, step 3 follows immediately after step 1.
So in order to do something with the step (for example, prefill default data based on the previous steps), I have no way to achieve this.
If the data would not have been dependant on previous steps, I could use ->default() on the individual form fields.
If the steps would not be conditional (e.g. some being hidden depending on previous steps), I could have used
afterValidation()
to prepare the next step.But in this case, I have no way to do that. In filament v3, the steps fired events like
wizard::previous-step
andwizard::next-step
that I could hook into, but filament v4 removed that so I'm left with no solution in v4.Proposal
So my proposal is to add additional callback functions in the Wizard's
nextStep()
function:Or maybe something like
fillUsing()
/modifyFillUsing()
... Just something that let's you hook into how the next step is initialized.If this is okay @danharrin, I can create a PR.
Beta Was this translation helpful? Give feedback.
All reactions