Skip to content

Sign-up Form

This content is for v0.7. Switch to the latest version for up-to-date documentation.

val := v.Is(
v.String(email, "email").Not().Blank(),
v.String(password, "password").Not().Blank().MinBytes(8),
v.Number(age, "age").GreaterOrEqualTo(18),
)
if err := val.ToError(); err != nil {
// Marshal err to JSON and return it from your handler.
return err
}

If you need all messages for a field, use Check(...).