Can't define field names of dynamically added input fields in yup schema #3417
Locked
ValentineSean
started this conversation in
General
Replies: 1 comment
-
This was answered here: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have file input fields that are dynamically rendered according to an array's elements.
<template> <Form :validation-schema="schema"> <div class="form-group" v-for="document in documents" :key="document.id"> <Field type="file" id="calculated-loan-purpose" name="document.id" /> <ErrorMessage name="document.id" class="input-group text-danger" /><br> </div> </Form> </template>
<script> import { Form, Field, ErrorMessage } from "vee-validate"; import * as yup from "yup"; export default{ components: {Form, Field, ErrorMessage}, data(){ const schema = { //dynamic field names document_id: yup.mixed().required() } } } </script>
How can I define dynamic field names in the schema.
Beta Was this translation helpful? Give feedback.
All reactions