vee-validate icon indicating copy to clipboard operation
vee-validate copied to clipboard

required_if is only working on first submit

Open pratiklabh opened this issue 1 year ago • 0 comments

when i try to submit paymentMode as online banking and not selecting bank then it shows validation error mentioning bank is required then i enter a bank and submit and (without refreshing the page) again if i submit online banking without selecting bank then validation is not working, data can be submitted

Transaction Information Form

  <!-- Bank Name Dropdown Column -->
  <Column header="Bank Name">
    <template #body="{ data }">
      <Field name="bank" v-slot="{ field }" :rules="requiredIfOnlineBanking(data.paymentMode)">
        <Select
            v-model="data.bank"
            v-bind="field"
            :options="banks"
            optionLabel="label"
            optionValue="value"
            placeholder="Select Bank"
            class="w-full"
            :disabled="data.paymentMode !== 'Online Banking'"
        />
        <ErrorMessage name="bank" class="error" />
      </Field>
    </template>
  </Column>
</DataTable>

<Button type="submit" class="submit-button">
  Submit
</Button>

pratiklabh avatar Sep 25 '24 11:09 pratiklabh