Corex. FormField
(Corex v0.1.1)
View Source
Shared helpers for Corex components that accept field={@form[:name]}.
assign_form_field/2 wires id, name, form, errors, and field_used. It does not
set invalid from changeset errors. Pass invalid on the component when you want
alert styling (data-invalid):
<.select field={@form[:country]} invalid={FormField.invalid?(@form[:country])} />Error messages still come from the :error slot via assign_errors/2.
Summary
Functions
@spec assign_errors(map(), Phoenix.HTML.FormField.t()) :: map()
@spec assign_form_field(map(), Phoenix.HTML.FormField.t()) :: map()
@spec assign_ids(map(), Phoenix.HTML.FormField.t()) :: map()
@spec invalid?(Phoenix.HTML.FormField.t()) :: boolean()