Formify Docs

Alphanumeric

Validate that a value contains only letters and digits

Alphanumeric

The alphanumeric rule validates that a value contains only letters and digits — no spaces, punctuation, or symbols.

Configuration

Config flagTypeDescription
alphanumericbooleanRequires letters and digits only.
validationSchema: {
  handle: { alphanumeric: true },
}

With a custom message:

handle: { alphanumeric: "Letters and numbers only" }

V builder

import { V } from "formify-js";

V.alphanumeric()
V.alphanumeric("Letters and numbers only")

Default message

Only letters and numbers allowed

Examples

ValueResult
"abc123"✅ Valid
"abc 123"❌ Invalid (space)
"abc_123"❌ Invalid (underscore)

Things to know

  • Empty values pass unless required: true is also set.
  • Use the username validator when underscores or dots should be allowed.

On this page