Wizard Step event dispatching issue inside aftervaliadtion()

I'm having trouble opening a modal in during the step form validation. Here's what my code looks like:
Step::make('step1')
->schema([])
->aftervalidation(function(){
$this->dispatch('open-modal', id: 'posmodal');
// other logic codes ..........

});
Step::make('step1')
->schema([])
->aftervalidation(function(){
$this->dispatch('open-modal', id: 'posmodal');
// other logic codes ..........

});
The issue is that the modal only opens after the entire code execution of aftervalidation, instead of when the next button is clicked means at the starting of aftervalidation code execution. My goal is to display the modal on next button click and keep it open until a specific code is executed inside fo the aftervalidation(). I've set up a JavaScript listener, but it seems the dispatch event is only happening after whole the code execution. Is there any way i can open the modal instantaneously on next button click ?
2 Replies
technocrat
technocrat2mo ago
anybody?
Dennis Koch
Dennis Koch2mo ago
You’d need a client side solution if you want to instantly open a modal. Not sure how to hook into the next button though.