Phoenix.HTML v2.13.3 Phoenix.HTML.FormData protocol View Source
Converts a data structure into a Phoenix.HTML.Form
struct.
Link to this section Summary
Functions
Receives the given field and returns its input type (:text_input,
:select, etc). Returns nil
if the type is unknown.
Returns the HTML5 validations that would apply to the given field.
Returns the value for the given field.
Converts a data structure into a Phoenix.HTML.Form
struct.
Converts the field in the given form based on the data structure
into a list of Phoenix.HTML.Form
structs.
Link to this section Types
t()
View Source
t() :: term()
t() :: term()
Link to this section Functions
input_type(data, form, field)
View Source
input_type(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) ::
atom() | nil
input_type(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) :: atom() | nil
Receives the given field and returns its input type (:text_input,
:select, etc). Returns nil
if the type is unknown.
input_validations(data, form, field)
View Source
input_validations(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) ::
Keyword.t()
input_validations(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) :: Keyword.t()
Returns the HTML5 validations that would apply to the given field.
input_value(data, form, field)
View Source
input_value(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) :: term()
input_value(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field()) :: term()
Returns the value for the given field.
to_form(data, options)
View Source
to_form(t(), Keyword.t()) :: Phoenix.HTML.Form.t()
to_form(t(), Keyword.t()) :: Phoenix.HTML.Form.t()
Converts a data structure into a Phoenix.HTML.Form
struct.
The options are the same options given to form_for/4
. It
can be used by implementations to configure their behaviour
and it must be stored in the underlying struct, with any
custom field removed.
to_form(data, form, field, options)
View Source
to_form(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field(), Keyword.t()) ::
[Phoenix.HTML.Form.t()]
to_form(t(), Phoenix.HTML.Form.t(), Phoenix.HTML.Form.field(), Keyword.t()) :: [Phoenix.HTML.Form.t()]
Converts the field in the given form based on the data structure
into a list of Phoenix.HTML.Form
structs.
The options are the same options given to inputs_for/4
. It
can be used by implementations to configure their behaviour
and it must be stored in the underlying struct, with any
custom field removed.