# Form methods

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

To retrieve the values of your form or to make changes to the form, Formisch provides you with several methods. These apply either to the entire form or to individual fields.

## Reading values

To retrieve values from your form, you can use:

- [`getInput`](/methods/api/getInput.md): Get the current value
  of a specific field
- [`getErrors`](/methods/api/getErrors.md): Get error messages
  for a specific field
- [`getDeepErrors`](/methods/api/getDeepErrors.md): Get all error
  messages across the entire form

Formisch uses Angular Signals internally which means that reading values with these methods is reactive. When you call them inside a `computed`, an `effect` or a template expression, they re-run automatically as soon as the form state changes — including in `OnPush` and zoneless components.

## Dirty state

To work with the dirty state of your form, Formisch provides three methods:

- [`getDirtyInput`](/methods/api/getDirtyInput.md): Get the dirty
  parts of the form input
- [`getDirtyPaths`](/methods/api/getDirtyPaths.md): Get the paths
  of dirty fields
- [`pickDirty`](/methods/api/pickDirty.md): Filter an
  externally-supplied value down to its dirty parts using the form's dirty mask

See the [dirty fields](/angular/guides/dirty-fields.md) guide for when to reach for each.

## Setting values

To manually update form values or errors, use:

- [`setInput`](/methods/api/setInput.md): Manually update the
  value of a specific field
- [`setErrors`](/methods/api/setErrors.md): Manually set error
  messages for a specific field

> If you need to update the form because the initial data has changed (e.g., remote data was refreshed), use [`reset`](/methods/api/reset.md) with a new `initialInput` instead of `setInput`. The `reset` method properly reinitializes the form state, while `setInput` only changes the current input values without updating the initial state.

## Form control

To control the form programmatically, use:

- [`handleSubmit`](/methods/api/handleSubmit.md): Create a submit
  event handler that validates the form and calls your handler on success
- [`reset`](/methods/api/reset.md): Reset the form to its initial
  state or update initial values
- [`validate`](/methods/api/validate.md): Manually trigger
  validation of the entire form
- [`submit`](/methods/api/submit.md): Programmatically trigger
  form submission
- [`focus`](/methods/api/focus.md): Focus on a specific field

## Array operations

For working with field arrays, Formisch provides:

- [`insert`](/methods/api/insert.md): Insert a new item into a
  field array
- [`remove`](/methods/api/remove.md): Remove an item from a field
  array
- [`move`](/methods/api/move.md): Move an item to a different
  position in a field array
- [`swap`](/methods/api/swap.md): Swap two items in a field array
- [`replace`](/methods/api/replace.md): Replace an item in a
  field array

## API design

All methods in Formisch follow a consistent API pattern: the first parameter is always the form store, and the second parameter (if necessary) is always a config object. This design makes the API flexible and consistent across all methods. Once you understand this pattern, you basically understand the entire API design.

Here are some examples:

```ts
// Get the value of a field
const emailInput = getInput(this.loginForm, { path: ['email'] });

// Reset the form with new initial values
reset(this.loginForm, { initialInput: { email: '', password: '' } });

// Move an item in a field array
move(this.loginForm, { path: ['items'], from: 0, to: 3 });
```

## API reference

You can find detailed documentation for each method in our [API reference](/angular/api/).
