Reputation: 183
I want to get the min parameter on the error message for the following code
extend('min', { ...min, message: 'The {_field_} field must have at least {_min_} characters'})
the _min_
variable param is not returned when the field is not valid. How do i access that parameter
Upvotes: 1
Views: 435
Reputation: 2516
You are facing two issues.
The minimum rule uses length
rather than min
as a parameter name (reference)
Parameter fields are not surrounded by underscores - as per the documentation - see below:
One thing to note is that the parameter placeholder doesn't have underscores
_
around it unlike the{_field_}
placeholder. This is a convention of vee-validate as there are special set of placeholders that have underscores around them. This is to prevent collisions and to make them distinct from rule parameters.
So for your code:
extend('min', {
...min,
message: 'The {_field_} field must have at least {length} characters'
})
Upvotes: 3