Skip to content
Advertisement

How to triggter validation in wizard when cliking on Next button?

In Laravel 8 app which uses vuejs and jquery I found wizard made with html like :

JavaScript

and inited js function

JavaScript

By clicking on “Next” button next step is opened, but I need to validate inputs before moving to next step. Please any hints how can I make validation here ? Also is it some library? I searched in net but drowned…

Thanks!

Advertisement

Answer

Each wizard view send wizard position in ajax.In backend based on wizard position validate fields .since you know which and all field exist in each wizard view.

For example consider you have 3 wizard steps.

Step 1 has 3 input fields

Step 2 has 2 input fields

Step 3 has 1 input fields

Suppose if you send current step is 1 then you can only validate those fields.

JavaScript

then based on request wizard step you can easily fetch validation rules

JavaScript

Or you can make all fields validate only if exists in the request

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement