Vee-validate: Dynamic parameter/argument in data-rules

Created on 31 Oct 2016  Â·  13Comments  Â·  Source: logaretm/vee-validate

Hi, Is it possible to dynamic add data to the data-rules? You see a example below but it's not working.

<input v-validate data-rules="numeric|toLow:{{ amount }}" name="bieden" v-model="bieden" type="number">

Validator.extend('toLow', { getMessage: field => 'Error tolow', validate: function(value, options) { console.log(value); console.log(options); } });

✨ enhancement

Most helpful comment

When it will be implemented, cause it's very important feature?

All 13 comments

currently its not possible since the rules are evaluated only once the directive was bound, but I might add support for this though since it is very common, we talked about something similar here in #54.

Thanks for the feedback.

Ah excuse me, clicked several issues but don't see that one.

That should be a very nice feauture, if you can use data object dynamic in the data-rules, I hope you add it soon!

When it will be implemented, cause it's very important feature?

In a couple of days, I'm kind of stressed at work atm.

Thank you!For now implemented it by rerendering input using timeout.

Is there any way to change field only in message?The ${field} must be a valid value.
Here.

@BrandonSurowiec Thank you.That is exactly what I needed.By the way nice plugin.Easy to work with.Thanks for work

has it been implemented as well as the dynamic validation? I would be awesome! Tks.

@logaretm Is this already developed or still a nice to have feature?

should be next up for the next release, will require some breaking changes tho.

Hi.Have some problem.
Validator.fieldBag.fields.model.dirty and Validator.fieldBag.fields.model.clean aren't changing according to input.
Or there is another way to track if input clean or dirty?
Any suggestions?

@yusupprog I'm having issues making them reactive at the moment, you can use the methods approach.

this.$validator.fieldBag.dirty('someField');

// or

fields.dirty('someField'); // since fields are injected in your Vue instance.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

MeltedFreddo picture MeltedFreddo  Â·  3Comments

Youdaman picture Youdaman  Â·  3Comments

Etheryte picture Etheryte  Â·  3Comments

YamenSharaf picture YamenSharaf  Â·  3Comments

HunterJS-bit picture HunterJS-bit  Â·  3Comments