F
Filament5mo ago
SirFat

Validation/Pre-Action on Submit within a Wizard

Heya! I'm trying to have the Wizard I have created perform a step that occurs before or within the submit action that provides an additional piece of functionality. In this case, the task is to take a payment and if the payment fails, consider it 'validation failed' which displays a message on the screen and aborts the submit process. What would be even better is that a modal pops up to handle this, but at this point I'm at the path of least resistance. * I have looked for any life cycle hooks and couldn't see any in the overarching Wizard class that are helpful. * I have tried passing in 'Set' to the submit function and setting the validation error and then throwing Halt
1 Reply
SirFat
SirFatOP5mo ago
If there isn't anything out the box, I wonder if looking into the listener-registration or creating a setSubmitAction that accepts a Closure may be of value, or whether that's against the spirit of the way it's written. I can see I can pass '$action' into submitAction() - but I cannot ascertain where '$action' would be constructed to have it passed as an argument, which is possibly also an oversight/misunderstanding on my part To clarify my submitAction use - I use a custom blade to render the button per the guide. I attempted to perform validation in there but I couldn’t use Set because at that point in the flow the form element has not yet been initialised. Perhaps that’s because the blade button side-steps all validation hooks?
Want results from more Discord servers?
Add your server