0

I've made a dynamic multi-page form that works using "step". When I press the next button, I increment the step variable, which takes us to the next page like this:

<button type="submit" @click="step = Math.min(step + 1, 9)" class="bouton-classic-noir">Étape suivante</button>

Differents form pages :

<div x-show="step === 1" class="text-center">
     <div>
           @livewire('creation-audit')
     </div>
</div>
<div x-show="step === 2" class="text-center">
      <div>
          @livewire('questionnaire-form')
      </div>
</div>

I then wanted to add validation constraints, so I'm forced not to use the step+1 increment in the button, because when I press my next button I want : -form verification in the livewire component -return errors in the view

In the view, I have :

@if (!$errors->any())
    {{-- "step = Math.min(step + 1, 9)" --}}
@endif

I'm stuck here, so in the "no errors" condition I need to be able to increment the step by 1 to move on to the next page.

Thanks in advance for your help

0