isUnique rule for collection on Vuelidate Next
See original GitHub issueHey Guys! I researched all issues and don’t understand how i can implement my rule isUnique
for collection. Could you help me? Please 😦
I also looked at https://github.com/vuelidate/vuelidate/issues/781
So, for Vuelidate first version i had this solution
validations() {
return {
collection: {
$each: {
title: {
isUnique: isUnique(this.collection, 'title')
}
}
}
};
},
and helper
export default function isUnique(group, key) {
return (value) => {
const found = group.filter(item => {
if (key) {
return item[key] === value;
}
return item === value;
});
return found.length <= 1;
};
}
How i can migrate my solution for Vuelidate next?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Examples | Vuelidate
Collections validation #. A parent element will collect all of its child component validations. This allows for easy validation of collections. < ...
Read more >Vuelidate | A Vue.js model validation library
Simple, lightweight model-based validation for Vue.js 2.0. Model based; Decoupled from templates; Dependency free, minimalistic library; Support for collection ...
Read more >Ndianabasi Udonkang's Tech Blog
Validating the Contact Form with Vuelidate | Full-Stack Google ... The above rule will ensure that the isUnique async function is only ...
Read more >How to properly add custom validation to array in vuelidate
I have an array of objects with the following structure ... I found the official guide here: vuelidate.js.org/#sub-collections-validation .
Read more >Easy Form Validation With Vuelidate | Vue 3 - YouTube
Join My Weekly Dev Newsletter: https://www.johnkomarnicki.com/#newsletterForm validation is an essential part of any form, and you want to ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Create a simple repro in codesandbox and we can try to help
This is very inconvenient for me, use another component for each object 😦