DynamicForm.Helpers.Form (DynamicForm v1.0.0)

Copy Markdown View Source

Plumbing for the Phoenix.HTML.Form structs the library renders against.

Internal module — not part of the public API.

Summary

Functions

The whole form's current values: the applied changeset when the form is changeset-backed. Render-only mode renders against a parent-owned form, so a non-changeset source falls back to its params.

The form's current raw params — the changeset's changes — or an empty map when the form's source has none.

Attaches the form-level data to the value a slot body receives. It rides in the form's options, which is private plumbing — DynamicForm.form_data/1 is the contract. Only slot bodies are decorated: the root form is rendered by Phoenix.Component.form/1, which spreads its options onto the <form> tag.

Functions

get_applied_data(form)

The whole form's current values: the applied changeset when the form is changeset-backed. Render-only mode renders against a parent-owned form, so a non-changeset source falls back to its params.

get_params(form)

The form's current raw params — the changeset's changes — or an empty map when the form's source has none.

put_data(field, data)

Attaches the form-level data to the value a slot body receives. It rides in the form's options, which is private plumbing — DynamicForm.form_data/1 is the contract. Only slot bodies are decorated: the root form is rendered by Phoenix.Component.form/1, which spreads its options onto the <form> tag.