Transformer Plugin
Transforms the value seen by a specific validator without modifying the actual input. Other validators on the same field receive the original value.
Options
The options object is a nested map:
ts
{
[fieldName: string]: {
[validatorName: string]: (field: string, element: HTMLElement, validator: string) => string
}
}Each transform function receives the field name, the DOM element, and the validator name, and returns the value string to use for that validator.
Playground
Notes
- Only the specified validator sees the transformed value —
notEmptyon the same field always sees the raw value. - The transform function is called on every validation run; it does not modify the DOM.
- Disable the plugin with
fv.disablePlugin('transformer')to revert to raw values. - Works with the built-in
field-valuefilter hook added to Core.