Non-blocking Input Validation Workaround #306
-
Hi all! RelatedThis is probably related to #289 and #185 GoalTo produce a field that looks like this:
And when the input is added...
...a warning will appear on the side denoting incorrect input. What I've triedI've tried providing a
and will only allow input that follows the rules set by What I'm requestingI understand that #185 seeks to get around this by modifying the current API. However, for me, right now, this is project blocking, so I wonder if there may be a temporary work around. I've tried my best, but unfortunately I'm learning Go and the charm-verse at the same time, and am a bit over my head! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Sorry for the delay! I'll take a look 👀 |
Beta Was this translation helpful? Give feedback.
-
I see what you mean about how
PS: If you want the formatting to match your example: |
Beta Was this translation helpful? Give feedback.
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 inUpdate
after the user types and assign the error to the model's error field, then check that inView
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 questionshttps://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 uselipgloss.JoinHorizontal
…