Credit card form example - validation not working? #1146
-
I'm working with the credit card form example to play with the validation of text inputs. Unless I'm doing something very wrong, the example's text input validation is not working at all. I added logging to check that the validate functions are getting called and returning errors, but I do not see any errors on the TUI. I have never seen an example of validation on textinputs in action, so I'm not 100% sure how it should look on the screen, but nothing happens at all. Has anyone else noticed this or am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
yeah, example doesn't show errors in the tui
// Gather some final details about the order.
huh.NewGroup(
huh.NewInput().
Title("What’s your name?").
Value(&name).
// Validating fields is easy. The form will mark erroneous fields
// and display error messages accordingly.
Validate(func(str string) error {
if str == "Frank" {
return errors.New("Sorry, we don’t serve customers named Frank.")
}
return nil
}), |
Beta Was this translation helpful? Give feedback.
-
Wow, the example in Bubble Tea is totally broken. Let's fix that one posthaste. |
Beta Was this translation helpful? Give feedback.
yeah, example doesn't show errors in the tui
huh
has ability to show errors via validatehttps://pkg.go.dev/github.com/charmbracelet/huh#section-readme