Troubleshooting Vee-validate scope issues in Nuxt.js and Vuetify

I'm experiencing an issue with validation using vee-validate and Vuetify:

I have two forms with different scopes, both being submitted within one function. While the validation is functioning correctly upon submission, the input errors are not displaying on the UI:

The inputs belong to different scopes:

<v-text-field
   id="PersonalName"
   v-model="PersonalName"
   label="Name"
   :error-messages="errors.collect('Name')"
   v-validate="'required|alpha_spaces'"
   data-vv-name="Name"
   data-vv-scope="scopePersonal"
   prepend-icon="face"
></v-text-field>

and

<v-text-field
   id="DeliveryAddressLine"
   v-model="DeliveryAddressLine"
   prepend-icon="home"
   v-validate="'required'"
   label="Delivery Address"
   data-vv-name="deliveryaddres"
   :error-messages="errors.collect('deliveryaddres')"
   data-vv-scope="shippingAddress"
   >
</v-text-field>

Here is the function within methods:

async personalDetails () {
      var isPersonalDetails = false
      await this.$validator.validate('scopePersonal.*').then((isValid) => {
        if (isValid) {
          // do something
          isPersonalDetails = true
        } else {
          console.log('error on personal details')
        }
      })
      if (this.isDeliveryAddress) {
        await this.$validator.validate('shippingAddress.*').then((isValid) => {
          if (isValid) {
            // do something
            isPersonalDetails = true
          } else {
            isPersonalDetails = false
          }
        })
      }
      // move to next step - Vuetify
      if (isPersonalDetails) { this.residentialOrder = 6 }
    },

Validation is working as expected and progresses to the next step when inputs are valid (e.g. alpha_text without numbers), but the error messages are not shown on the inputs themselves.

Any suggestions on how to resolve this issue?

Answer №1

The key to success lies in incorporating scope into your collection method

:error-messages="errors.collect('shippingAddress.deliveryaddres')"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Stop RequireJS from Storing Required Scripts in Cache

It seems that RequireJS has an internal caching mechanism for required JavaScript files. Whenever a change is made to one of the required files, renaming the file is necessary in order for the changes to take effect. The typical method of adding a version ...

Ways to assign sx property to Icons using menu.map method in Material-UI?

Currently, I am working on designing a menu with icons in Material UI. Everything is functioning properly, but I am facing a challenge in understanding how to pass the sx prop into the Icon when using the map function. Here is an example: export const Me ...

The AJAX call is not being identified correctly

I am facing an issue with my search result pagination wherein the page reloads instead of loading via AJAX when using the pagination. The search results are correctly loaded through partial view with AJAX, but the pagination triggers a non-ajax request cau ...

div value causing erratic behavior in cycling process

Instead of following the normal balance calculation (1000-950), something odd happens and the balance goes from 1000 to 0 with the while loop. I never intended for the refBalance to drop below 0. (numDebit2() returns 50) <div class="elemen ...

jQuery is unable to manipulate newly added DOM elements that have been loaded via AJAX

Having trouble with jquery ajax. Unable to interact with newly added element through ajax. Code snippet: $(".yorum_input").keypress(function(e) { if (e.keyCode == 13) { e.preventDefault(); var alt_id = $(this).attr('yorum_id'); va ...

Creating variable assignments based on object properties

I am facing a dilemma with a simple object that contains constants. { KEY1: "value1", KEY2: "value2" } I am looking for a way to make these constants accessible globally. Currently, I have to use Config.KEY1 to access the values globally, but I w ...

Modifying the Vue.js Vue3-slider component for custom color schemes

Currently, I am using the vue-slider component and would like to customize the color of the slider itself. The specific class that needs to be styled is "vue-slider-dot-tooltip-inner". Below is a screenshot displaying the original CSS styling for vue-slid ...

The Vue warning states that the property "$store" was attempted to be accessed during rendering, but it is not defined on the current instance

Hello, I am new to the world of web development and currently working on an online shop project. I have encountered two errors that I'm struggling to fix: 1) [Vue warn]: Property "$store" was accessed during render but is not defined on instance. 2) ...

Tips for dividing a single row retrieved from a MySQL database that has been converted with json_encode so that it can be shown in

Looking to extract data from a MySQL query result in one PHP page and transfer it to a separate page with JavaScript. Here is my attempt so far: I am aiming to retrieve specific values from the selected row in the MySQL table and populate them into #event ...

Avoid directing to the identical component within a React application

When I try to redirect my component to the same component with different parameters, it is not working properly. <BrowserRouter basename={process.env.REACT_APP_DEFAULT_PATH ?? ''}> <Switch> ... < ...

Revise the line graph

Currently, I am utilizing dimple js and have a line chart code. However, there seems to be an issue with the event I set up - whenever a button is clicked, the chart should redraw using chart.draw(), but this function doesn't seem to work. Any insight ...

Mastering various mathematical operations in Vue.js

I am attempting to calculate the percentage of a value and then add it back to the original value using Vue.js. Here is an example: 5 / 100 * 900 + 900 = 945.00 (standard calculation) 5 / 100 * 900 + 900 = 90045 (Vue.js calculation) This is the code I ha ...

Conquering cross-origin resource sharing (CORS) using XMLHttpRequest without relying on JSONP

Appreciate your time in reading this inquiry! For the past few days, I've been grappling with an AJAX request issue. Despite scouring through numerous answers on Stack Overflow, I'm still unable to find a resolution. Any assistance would be grea ...

unable to locate the sw.js file in the Vue plugin PWA

My experience with using the vue PWA plugin has been positive so far. I have one app that works great with it. The configuration for this app in VueJS looks like this: const WebpackNotifierPlugin = require('webpack-notifier') module.exports = { ...

Is there a way for me to customize the footer of the modal in Vue CoreUI?

I recently came across some code in the coreui vue template that looks like this: <b-modal title="Modal title" class="modal-success" v-model="successModal" @ok="successModal = false" ok-variant="success"> Lorem ipsum dolor sit amet, consectetur adip ...

In Firebase within the Next.js framework, encountering an error where the property 'length' of an undefined element cannot be read

I am encountering an issue with Firebase in Next.js, displaying the error message: TypeError: Cannot read property 'length' of undefined Is there a way to resolve this error? Below is my Firebase configuration file: import * as firebase from &q ...

A method to eliminate click events for an element

I have a unique element called #foo with a click event attached to it. This element is nested within another element called #bar, which also has a separate click event attached to it. <div id="bar"> <div id="foo" /> </div> Currently, ...

Using Node.js to download files with like wget, unzip them, and convert them to JavaScript without saving to

Currently, I am working on a script for a nodejs/express server-side application using the libraries request, unzip, and xml2js. The goal of this script is to fetch a zip file from a specified URL, extract an XML file from it, and then parse that XML into ...

Easily toggle between various image source paths

In my current application, all HTML files have hardcoded relative image paths that point to a specific directory. For example: <img src="projectA/style/images/Preferences.png"/> Now, I am considering switching between two different project modes: & ...

Can you explain the function of v-bind within Vue?

I recently started learning Vue and decided to follow a video tutorial by Traversy Media on Youtube In the tutorial, the instructor used v-bind but I struggled to understand its usage. Despite my efforts, I still find the documentation a bit challenging ...