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

useField - reactive field-id not working #4849

Open
2 of 5 tasks
OlliL opened this issue Aug 28, 2024 · 0 comments
Open
2 of 5 tasks

useField - reactive field-id not working #4849

OlliL opened this issue Aug 28, 2024 · 0 comments

Comments

@OlliL
Copy link

OlliL commented Aug 28, 2024

What happened?

I have to use a uno-ui input-component which has no name and it's id is generated and private. So I need to "find" the input fields ID to make useField work.
It all works until I start giving the field an initial value. No matter if i use the initialFieldValue option, use setValue or setting value. The moment I try to set a field value programatically the field validation breaks. The errorMessage is no longer printed out.
Validation still works in the background somehow (preventing submitting for example) but it looks like the reference to the error message returned by useField is detached from the field registered and validated in vee-validate.

Reproduction steps

  • Open Stackblitz link
  • notice: input field display "hugo" (an error message should be shown because the input field should contain at least 7 chars)
  • hit submit
  • notice: nothing happens - still no error message shown, no alert window pops up (which should on a successful submit)
  • now uncomment setValue(props.modelValue); at the end in InputText.vue
  • hit submit
  • notice error message shown

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/puuk1z-8qgtme?file=src%2FInputText.vue

Code of Conduct

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

1 participant