This data belongs to me
Each time a user inputs a code, it must be unique. If the value already exists, an error message should be displayed indicating that the branch code already exists.
branches: [
{
code: "test",
name: "test",
email: "test",
website: "test.com",
phone: "test",
address: {
street: "test",
city: "test",
township: "test",
state: "test",
zip_code: "test",
country: "test",
},
google_maps_url: "test.com",
},
],
Here is my code. Do not focus on company_details at the moment as I have not provided all the data. This is a more complex situation where I am unable to display errors for specific index fields. The index is passed as a parameter to the function in v-on blur.
for(var i=0; i < this.company_details.branches.length; i++){
if( this.company_details.branches[i].code == this.company_details.branches[index].code){
count +=1;
}
if (count==2){
this.BranchCodeArray[index].exists = true;
}
else{
this.BranchCodeArray[index].exists = false;
}