Validator

Client-side form validation with inline error messages, blur/input triggers, and built-in rules. Prevents layout shifts by using Manhattan styling instead of native HTML5 validation.

Registration Form Example

Fill out the form and submit to see validation...
PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->validator($formId)stringCreate a validator targeting the form with the given ID.
->field($name, $message, $rules)string, string, arrayAdd a field to validate. Flag rules are plain strings ('required', 'email'); value rules are single-key arrays (['minLength' => 8], ['pattern' => '^\.+$']).
->onSubmit($callback)stringJS code to execute when the form passes all validation.
->validateOnBlur($enabled)boolValidate fields when they lose focus (default: true).
->validateOnInput($enabled)boolValidate fields in real-time on each keystroke (default: false).

JS JS Validation Rules

Method / PropertyParametersDescription
requiredField must have a non-empty value.
emailValue must be a valid email address.
minLengthintMinimum string length.
maxLengthintMaximum string length.
minnumberMinimum numeric value.
maxnumberMaximum numeric value.
integerValue must be a whole number.
positiveValue must be a positive number.
patternstring (regex)Value must match the given regex pattern.
customfunction(value, input)Custom validation function returning true/false.