Vee-validate: How to validate two different forms on one page?

Created on 8 Mar 2018  ·  10Comments  ·  Source: logaretm/vee-validate

Versions:

  • VueJs: 2.5.13
  • Vee-Validate: 2.0.5

Description:

I have two different forms on one page (one form show via modal, I use Bulma CSS framework). If I submit one of this form — it's not validates, because other form (on these page) is still not filled and rises error validation.

Can somebody help me to solve this issue? Please.

Most helpful comment

Only work on two different form not different form elements

I'm having the same problem. The validation works on both forms when I pass the scope but no longer highlights the fields or shows the error messages.

Got it to work now, I had to use:

:type="{ 'is-danger': errors.has('scope-name.fieldname') }"
:message="errors.first('scope-name.fieldnamee')"

All 10 comments

Answer is here: http://vee-validate.logaretm.com/examples.html#scope-example

Just add data-vv-scope attribute with form name to form tag and add scope params to submit form function 👍

@koddr the page not work :(

This does not work if you have two separate methods for two different forms.

yes it doesn't work if you have two separate methods for two different forms !

Confirmed, does not work

Only work on two different form not different form elements

Only work on two different form not different form elements

I'm having the same problem. The validation works on both forms when I pass the scope but no longer highlights the fields or shows the error messages.

Only work on two different form not different form elements

I'm having the same problem. The validation works on both forms when I pass the scope but no longer highlights the fields or shows the error messages.

Got it to work now, I had to use:

:type="{ 'is-danger': errors.has('scope-name.fieldname') }"
:message="errors.first('scope-name.fieldnamee')"

The above link still doesn't work but I think it should go to the v2 docs here). Does v3 differ in how form scoping is handled?

Was this page helpful?
0 / 5 - 0 ratings