question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Triggering validation for single keys on an $each validation?

See original GitHub issue

How to trigger validation for a list of items? Here’s an example of validation declaration:

  validations: {
    request: {
      currency: {
        required
      },
      total_amount: {
        required,
        decimal,
      },
      cover_until: {
        required,
      },
      invoices: {
        $each: {
          amount: { required, decimal },
          vat: { required },
          issued_at: { required },
          due_at: { required }
        }
      }
    }
  },

Now when I want to trigger the validation for invoices, I presume I would do something like this:

this.$v.request.invoices.$touch()

What about when I want to validate only the issued_at key of a single invoice? How would that look like?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
dobromir-hristovcommented, Mar 15, 2022

Sorry, there isnt. That’s the drawback of this helper.

0reactions
Sonit90commented, Mar 15, 2022

There should be a way to not introduce another component.

const state = reactive( { translations: [{id: 1, title: ‘Sample title’, description: ‘Sample description’}] } )

const rules={ translations: { $each: helpers.forEach({ title: { required, }, description: { required, }, }), }, } useVuelidate(rules as any, voucher, { $lazy: true });

i can trigget v$.translations.$touch, but it will trigger both title and description

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to trigger Form Validators in Angular2 - Stack Overflow
The Validator on P will look at the model to determine the state of X and will validate P accordingly. Here's some code:...
Read more >
Angular Reactive Forms: trigger validation on submit
Validating all fields on submit ... To validate all form fields, we need to iterate throughout all form controls: Object.keys(this.form.controls).
Read more >
trigger validateKey - Rocket Software
The validateKey trigger defines the procedural checks that are done to validate a modified primary or candidate key. Validation is performed only if...
Read more >
Input Validation - OWASP Cheat Sheet Series
Input validation is performed to ensure only properly formed data is entering the workflow in an information system, preventing malformed data from persisting ......
Read more >
Constraint validation - HTML: HyperText Markup Language
By choosing the most semantically appropriate value for the type attribute of the <input> element, e.g., choosing the email type automatically ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found