-
for fields like your
and
Maybe I'm just misunderstanding. It seems to me like Yet if the user HAS finished and there are only 1 or 2 characters sent to It's likely that there's a technique for these sorts of situations that I'm not familiar with - if you know it, your knowledge is much appreciated. In my way of thinking, it seems like most field validation can only be completed once the user attempts to move focus to the next field. It would be nice if the various *Style's could automatically be set to an global lipgloss.Style for errors when field validation fails... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @erwin, You can definitely do validation and throw errors at any point. You just need to add a helper function to add whatever specifics you're looking for. I created a gist to show you. You can call the min length validation when the user hits enter, which is how they would indicate "done" with a field. From there you could use the result to block them from going to the next field, or just show the error message and do nothing, which is what I've done in the Gist for simplicity's sake. https://gist.github.com/bashbunni/fed91563900a9f6e20cde881fe68ac31 I hope that helps. Let us know if you're still unsure or if there's a part of the question I missed. |
Beta Was this translation helpful? Give feedback.
-
Thank you @bashbunni That is pretty much how I ended up handling it, and it works well. |
Beta Was this translation helpful? Give feedback.
Hi @erwin,
You can definitely do validation and throw errors at any point. You just need to add a helper function to add whatever specifics you're looking for. I created a gist to show you. You can call the min length validation when the user hits enter, which is how they would indicate "done" with a field. From there you could use the result to block them from going to the next field, or just show the error message and do nothing, which is what I've done in the Gist for simplicity's sake.
https://gist.github.com/bashbunni/fed91563900a9f6e20cde881fe68ac31
I hope that helps. Let us know if you're still unsure or if there's a part of the question I missed.