Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure and validateOnBlur not working with primeVue #4706

Closed
2 of 5 tasks
UXProv opened this issue Mar 20, 2024 · 2 comments
Closed
2 of 5 tasks

Configure and validateOnBlur not working with primeVue #4706

UXProv opened this issue Mar 20, 2024 · 2 comments

Comments

@UXProv
Copy link

UXProv commented Mar 20, 2024

What happened?

I'm trying to trigger the errors display only after the field has been touched. From what I understood from the documentation I should use the configure({ validateOnBlur: true }) to achieve so. Also tried to set all the other properties to false, but unless I get the error message immediatly or onSubmit (I wasn't able to reproduce my local behaviour on stackblitz, but event stackblitz is not working as expected I guess.)

Reproduction steps

...

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

No response

Demo link

https://stackblitz.com/edit/vee-validate-v4-prime-vue-caaz2i?file=src%2FApp.vue

Code of Conduct

@no2ehi
Copy link

no2ehi commented Apr 26, 2024

HI, you use v-bind for each input component:

const [email, emailProps] = defineField('email');
<InputText
           v-bind="emailProps"
            v-model="email"
            aria-describedby="email-help"
            type="email"
            :class="{ 'p-invalid': errors.email }"
/>

@logaretm
Copy link
Owner

Like @no2ehi mentioned, you need to use the second item returned from the array to bind it to your input. it contains the events needed.

Also move the configure call to be earlier than your defineField calls, I don't recommend running it in the same component, this is mostly a global config to set in your main entry file main.js or otherwise.

configure({
  validateOnBlur: true,
  validateOnChange: false,
  validateOnInput: false,
  validateOnModelUpdate: false,
});

const [fullName, attrs] = defineField('fullName');
         <InputText
          v-bind="attrs"
            v-model="fullName"
            aria-describedby="fullName-help"
            :class="{ 'p-invalid': errors.fullName }"
          />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants