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 flag | Type | Description |
|---|---|---|
alphanumeric | boolean | Requires 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
| Value | Result |
|---|---|
"abc123" | ✅ Valid |
"abc 123" | ❌ Invalid (space) |
"abc_123" | ❌ Invalid (underscore) |
Things to know
- Empty values pass unless
required: trueis also set. - Use the
usernamevalidator when underscores or dots should be allowed.