Skip to content

Non-blocking Input Validation Workaround #306

Answered by bashbunni
KaiAragaki asked this question in Q&A
Discussion options

You must be logged in to vote

I see what you mean about how textinput.Validate blocks the behaviour. In this case, you could just define your own validation function that gets called in Update after the user types and assign the error to the model's error field, then check that in View and render accordingly. I've attached a Gist with my solution that gives the outcome shown in the attached image. Of course you can tweak styling, etc as needed. Hope that helps! Let us know if you still have questions


https://gist.github.com/bashbunni/4573b0fc981123875a835f1a0aa412ca

PS: If you want the formatting to match your example: > my favorite name is Larry | x Capital letters are not allowed you can use lipgloss.JoinHorizontal

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bashbunni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants