---
url: /api/formats/interactions/src/functions/initFormField.md
---
[pantoken-root](../../../../index.md) / [formats/interactions/src](../index.md) / initFormField

# Function: initFormField()

> **initFormField**(`host`, `control`, `error`): [`FormFieldHandle`](../interfaces/FormFieldHandle.md)

Associate an authored error after blur, native invalid events, or explicit validation.
Untouched fields stay quiet; edited fields revalidate after the first validation attempt.
Preserves hint references and uses native constraints, including `setCustomValidity()`.
The host must contain the control and a separate, named error element with message text.
Clean up and reinitialize after moving controls between forms or changing error IDs.

## Parameters

### host

`HTMLElement`

### control

[`FormFieldControl`](../type-aliases/FormFieldControl.md)

### error

`HTMLElement`

## Returns

[`FormFieldHandle`](../interfaces/FormFieldHandle.md)
