I am struggling to get my vuetify form to function as intended. I was trying to get my form to validate once I hit submit without refreshing but also my two components one depends on the other. There is a select box and if one or the other entry is chosen from the list then the rules change for the file in put to be only pdf and a singular entry. I am unsure how to get this to work as now the form does not validate based on those dynamic rules.
<v-form ref="uploadForm" v-model="uploadDocumentValidation" @submit.prevent>
<v-card-text>
<div class="text-medium-emphasis mb-4">
This operation will upload a doucument into ARMs.
</div>
<v-select
v-model="uploadTypeModel"
:items="cleanAllowableUploadTypes"
item-title="name"
label="File category uploading"
:counter="300"
class="mb-2 mt-5"
variant="outlined"
validate-on="submit"
return-object
:rules="objectRequiredRule"
></v-select>
<v-file-input
v-model="filesToUploadModel"
:show-size="1000"
color="primary"
label="File(s)"
placeholder="Select your file(s)"
prepend-inner-icon="mdi-file"
prepend-icon=""
variant="outlined"
validate-on="submit"
counter
comfortable
:multiple="uploadTypeModel != null && (uploadTypeModel.name == 'Revised Certification' || uploadTypeModel.name == 'Addendum') ? false : true"
:rules="uploadTypeModel != null && (uploadTypeModel.name == 'Revised Certification' || uploadTypeModel.name == 'Addendum') ? certificationOrAddendumRule : arrayRequiredRule"
:accept="uploadTypeModel != null && (uploadTypeModel.name == 'Revised Certification' || uploadTypeModel.name == 'Addendum') ? '.pdf' : ''"
>
<template v-slot:selection="{ fileNames }">
<template v-for="(fileName) in fileNames" :key="fileName">
<v-chip
class="me-2"
color="blue-accent-4"
size="small"
label
>
{{ fileName }}
</v-chip>
</template>
</template>
</v-file-input>
<div class="text-overline mb-2">HELPFUL INFORMATION</div>
<div class="text-medium-emphasis mb-1">
All files uploaded to ARMs are stored in the cloud with redundant backups of each version.
</div>
</v-card-text>
<v-divider class="mt-2"></v-divider>
<v-card-actions class="my-2 d-flex justify-end">
<v-btn
class="text-none px-5"
rounded="xl"
text="Cancel"
@click="isActive.value = false"
></v-btn>
<v-btn
class="text-none mr-3 my-3 px-5"
color="primary"
rounded="xl"
text="Upload"
variant="flat"
@click="uploadFiles()"
type="submit"
></v-btn>
</v-card-actions>
</v-form>
My script is as follows
const certificationOrAddendumRule = [
(v: any) => !!v || "File is required!",
(v: any) => v.type != 'application/pdf' || "File must be a pdf!",
(v: any) => !v.isArray || "Only one document allowed for this type of upload!"]