TianFeng provides two form utilities:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/wyvernjs/llms.txt
Use this file to discover all available pages before exploring further.
validate for checking whether a value matches a known pattern, and conform for normalizing and formatting user input into a canonical representation. Both objects are populated with methods at tf.init() time and live on your context.
validate option: validate
Each method accepts a string and returns a boolean. The underlying rules are pure regex tests (except validate.date, which delegates to new Date()).
| Method | What it checks |
|---|---|
validate.required(input) | Non-empty string |
validate.email(input) | Standard email format |
validate.phone(input) | 7–15 characters containing only digits, spaces, +, -, (, ) |
validate.alphabetic(input) | Letters only (a–z, A–Z) |
validate.numeric(input) | Digits only (0–9) |
validate.password(input) | 8+ chars with at least one uppercase letter, one digit, and one special char (!@#$%^&*) |
validate.url(input) | http://, https://, or ftp:// URL |
validate.creditCard(input) | Visa, Mastercard, Discover, AmEx, or JCB card number |
validate.zipCode(input) | Exactly 5 digits |
validate.date(input) | Parseable by new Date() |
HTML auto-wiring
Duringtf.init(), TianFeng scans the DOM for elements with data-validate-<type> attributes and attaches an input event listener that calls element.setCustomValidity(). This makes native browser validation pick up your custom messages automatically.
data-validity-error is absent, the fallback message is "Form needs to fit <type> form".
conform option: conform
Each method accepts a string and returns a formatted string, or false if the value cannot be conformed to the expected format.
| Method | Output format |
|---|---|
conform.phone(input) | (555) 123-4567 for 10-digit numbers; +1-555-123-4567 for 11+ digits |
conform.date(input) | YYYY-MM-DD |
conform.url(input) | Prepends http:// if no http:// or https:// prefix is present |
conform.email(input) | Lowercased canonical email, or false if invalid |
conform.alphabetic(input) | Uppercased string, or false if non-alphabetic chars are present |
conform.alphabeticSpace(input) | Letters and spaces uppercased, or false otherwise |
conform.creditCard(input) | XXXX XXXX XXXX XXXX (exactly 16 digits required) |
conform.simplePhone(input) | Strips all non-digit characters — useful for storage normalization. Also aliased as conform.simpleCreditCard. |
conform.simpleCreditCard is an alias for conform.simplePhone — both strip all non-digit characters from the input string. Use whichever name is clearer in context.