Skip to content

Vue component: Fix changeValidity event when there is an initial value #2022

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bettysteger
Copy link

@bettysteger bettysteger commented May 21, 2025

I am having trouble working with the changeValidity event. I would like to set the initial value when the number is empty to true and when not empty it should set wasPreviouslyValid to isValid(), see my change in this PR...

Maybe @carlssonemil can take a look?

The thing is, when pasting an invalid number into the input, I will not get "notified" that the phone number is invalid, because changeValidity is not triggered (because the initial value of wasPreviouslyValid is false).

@bettysteger bettysteger changed the title Fix changeValidity event when there is an initial value Vue component: Fix changeValidity event when there is an initial value May 21, 2025
@carlssonemil
Copy link
Contributor

I did not write that specific code (wasPreviouslyValid) so I'm not entirely sure why it is needed at all. Can't we always do the isValid check when the value changes and emit it, @jackocnr? I.e. remove the wasPreviouslyValid logic? 🤔

@bettysteger
Copy link
Author

I did not write that specific code (wasPreviouslyValid) so I'm not entirely sure why it is needed at all. Can't we always do the isValid check when the value changes and emit it, @jackocnr? I.e. remove the wasPreviouslyValid logic? 🤔

@carlssonemil @jackocnr yes that would be nice :D

@joaovinicius
Copy link

the same as #1980

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

Successfully merging this pull request may close these issues.

3 participants