Vee-validate: Config option for changing fieldbag Name.

Created on 21 Dec 2016  路  6Comments  路  Source: logaretm/vee-validate

Versions:

  • VueJs: 2.0
  • Vee-Validate: 2.0.0-beta.17

Description:

Is there a way change the fieldbag name , just like errorBag to avoid conflicts?

Currently vee-validate does not play well with https://github.com/ratiw/vue-table , because vue-table uses fields as a required prop.

Any help would be greatly appreciated 馃憤

Most helpful comment

try fieldsBagName it was misspelled in a couple of places, it was not documented because it does not work nicely with Vue 1.x versions.

All 6 comments

There is already an option, it is just undocumented at this time. The below code should work:

const config = {
    fieldBagName: 'fields', // change if property conflicts.
};

Vue.use(VeeValidate, config);

I tried updating to 2.0.0-beta.18 but the fieldBagName config does not seem to be working at the moment.

Its still conflicting with other dependencies.

Mayb that's the reason its undocumented.

try fieldsBagName it was misspelled in a couple of places, it was not documented because it does not work nicely with Vue 1.x versions.

@logaretm Works perfectly now! Thanks :)

Great, sorry about the confusion, I even misspelled it in the docs 馃槥

VeeValidate uses "fields" by default which causes a namespacing issue. To solve, it name their field anything else.... e.g. Naming it "veeValidateFields" fixed it for me.

const config = {
    fieldBagName: 'veeValidateFields', // change if property conflicts.
};

Vue.use(VeeValidate, config);
Was this page helpful?
0 / 5 - 0 ratings