Auto-jump to next step in Wizard

Hi! I'm using the Form-wizard with 3 steps. In the first step, there is a single question with the name medium (which is a custom field). When this question is answered, I want to jump to the next step in the form without explicitly clicking the next-button. I've succeeded by triggering the updated event on medium:
public function updatedMedium($value): void
{
$this->dispatchFormEvent('wizard::nextStep', '', 0);
}
public function updatedMedium($value): void
{
$this->dispatchFormEvent('wizard::nextStep', '', 0);
}
The problem is, when the Wizard goes to step 2, the validation seems to get triggered and all warnings of the required fields in step 2 are shown. Please refer to the picture. If I disable the updateMedium() method, and manually press the 'next'-button, the warnings are not shown. What seems to be the problem here?
1 Reply
The Milkman
The Milkmanβ€’2y ago
Ok, i'm stupid. I had placed my form inside a form what was causing the troubles 😦
<form wire:submit.prevent="submit">
{{ $this->form }}
</form>
<form wire:submit.prevent="submit">
{{ $this->form }}
</form>
Don't do this πŸ˜‰
Want results from more Discord servers?
Add your server