# `Zoi.Form`
[🔗](https://github.com/phcurado/zoi/blob/v0.17.4/lib/zoi/form.ex#L1)

Helpers for integrating `Zoi` objects with Phoenix (or any `Phoenix.HTML.FormData`)
forms.

This module focuses on turning your object schemas into form-friendly schemas and
returning a `%Zoi.Context{}` that implements the `Phoenix.HTML.FormData`
protocol.

# `parse`

```elixir
@spec parse(schema :: Zoi.schema(), input :: Zoi.input(), opts :: Zoi.options()) ::
  Zoi.Context.t()
```

Parses an object schema and returns the underlying `Zoi.Context`.

The returned context keeps the params in `context.input`, even when validations fail,
so it can be passed directly to `Phoenix.Component.to_form/2` or any `Phoenix.HTML`
form helper.

This function automatically normalizes LiveView's map-based array format (with numeric
string keys) into regular lists, so `context.input` always contains clean, manipulable
data structures.

# `prepare`

```elixir
@spec prepare(Zoi.schema()) :: Zoi.schema()
```

Tweaks an object schema to work nicely with HTML forms.

This function enables coercion on all nested fields so string params are coerced
into their target type and sets the empty values to `nil` and `""`, matching how
Phoenix sends form inputs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
