Skip to content

Why Input box value not force reset to old value if new value not accepted using x-data and x-model #4297

Answered by ekwoka
cencool asked this question in 1. Help
Discussion options

You must be logged in to vote

Okay, so it's just due to how the reactivity engine works.

Since you aren't setting the value here, when it's at the top level, the set isn't watched at all, but when it's a child, the set and get are seen and tracked even if the set doesn't do anything, so long as the value being set is different (even if it never gets added).

Curious that it works that way.

Anyhow, there are better ways to handle this specific need, like a mask, or validation attributes.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@SimoTod
Comment options

@cencool
Comment options

@ekwoka
Comment options

@ekwoka
Comment options

Answer selected by cencool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants