# validate

> This document is the Markdown version of [formisch.dev/methods/api/validate/](https://formisch.dev/methods/api/validate/). For the complete documentation index, see [llms.txt](https://formisch.dev/llms.txt).

Validates the entire form input against its schema. Returns a safe parse result indicating success or failure with detailed issues. Optionally focuses the first field with validation errors.

```ts
const result = validate<TSchema>(form);
const result = validate<TSchema>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`

## Parameters

- `form` `BaseFormStore<TSchema>`
- `config` `ValidateFormConfig | undefined`

### Explanation

The `form` parameter is the form store to validate. The optional `config` parameter allows specifying whether to automatically focus the first field with validation errors after validation.

## Returns

- `result` `Promise<SafeParseResult<TSchema>>`

## Related

### Primitives

[`useForm`](/react/api/useForm.md)

### Methods

[`focus`](/methods/api/focus.md), [`handleSubmit`](/methods/api/handleSubmit.md), [`setErrors`](/methods/api/setErrors.md), [`getErrors`](/methods/api/getErrors.md), [`getDeepErrors`](/methods/api/getDeepErrors.md)
