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
| Parameter | Type | Description |
|---|---|---|
path | string | 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
| Name | Type | Defined in |
|---|---|---|
clear() | () => void | - |
errors | Accessor<string[]> | - |
isValid | Accessor<boolean> | - |
state | Accessor<FieldValidationState> | - |
touch() | () => void | - |
validate() | () => ValidationResult | - |