Skip to content

array fields add validation status #5106

@gimler

Description

@gimler

Is your feature request related to a problem? Please describe.

I have my own collection component and use FieldArray to dis play a form with user objects (multiple fields) similar to https://vee-validate.logaretm.com/v4/examples/array-fields/.
I need to know the validation status of all array items and also for each entry to highlight the entry that is invalid.

I try useIsFieldValid() but it did not work because booth are not fields.

Describe the solution you'd like

  1. useIsFieldValid() also works with arrays and objects not only with fields
  2. new helper useIsPathValid()
  3. extend fields with validation informations
<template>
  <FieldArray v-bind="attrs" v-on="$attrs">
    <template #default="slotProps">
      <slot
        name="default"
        v-bind="{
          ...slotProps,
        }"
      />
    </template>
  </FieldArray>
</template>

<script setup>
import { FieldArray } from 'vee-validate'
import { useAttrs } from 'vue'

const attrs = useAttrs()
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions