BinarCode / vue-form-wizard

Vue.js 2 wizard
https://binarcode.github.io/vue-form-wizard/#/
MIT License
1.11k stars 244 forks source link

Form validation within child components. #360

Open mreduar opened 3 years ago

mreduar commented 3 years ago

Hi, I am here because I am having problems validating the forms inside the components of each step. Give an example to better understand what I want to achieve. I have the following code.

<form-wizard>
    <tab-content>
        <step1></step1>
    </tab-content>
    <tab-content title="Público">
        <step2></step2>
    </tab-content>
    ...
</form-wizard>

I have several components, each containing everything from a single step. For example in the step1 and step2 components, I have a form which I want to validate before passing to the next step. How can I achieve this? Due to the nature of the problem, I also don't know how to extract the form to the parent element. Which in this case is the component containing component.

mreduar commented 3 years ago

In one example I realized that I can achieve this with before-change in conjunction with ref like this. https://jsfiddle.net/CristiJ/bt5dhqtf/286/ Thank you