Skip to content

Function: useFieldValidation()

API / @xmachines/play-solid / useFieldValidation

function useFieldValidation(path, config?): object;

Defined in: @xmachines/json-render-solid

The validation of the field of path.

Parameters

ParameterTypeDescription
pathstring | Accessor<string | undefined>The path, or an accessor of the path, such as () => props.bindings?.value. A Solid component runs one time, so a plain path is the path of the mount. An accessor follows the path of now: in a row of a keyed repeat that moves, and for a binding that a later spec adds or removes.
config?ValidationConfig | Accessor<ValidationConfig | undefined>The config, or an accessor of it, such as () => ({ checks: [...props.checks] }). A config with a new value registers the field again.

Returns

object

NameTypeDefined in
clear()() => void-
errorsAccessor<string[]>-
isValidAccessor<boolean>-
stateAccessor<FieldValidationState>-
touch()() => void-
validate()() => ValidationResult-