E052 — Unsupported changeset form projection

Copy Markdown View Source

For app developers using the experimental LiveLift compiler.

A marked handler can project a literal field from a supported Phoenix.Component.to_form/2 changeset. The form options and the selected field are part of the compiled expression. Unsupported casts and validators also use E052. Use literal string fields and the validators in the language guide.

An option evaluated from the event causes E052. The snippets here illustrate the rejection and its correction.

Phoenix.Component.to_form(changeset, action: params["action"])

Use a literal option and select a field included in cast/3.

Phoenix.HTML.Form.input_value(
  Phoenix.Component.to_form(changeset, action: :validate),
  :title
)

For errors, use Enum.map/2 over the field's errors and return safe values from the message and Keyword.get(opts, :count). Keep other error metadata, dynamic form options, and changeset structs in a server handler. Remove @client true to run that handler through LiveView.

The parity fixture uses the supported reads with actual Ecto and Phoenix forms.