formex v0.2.0 Formex.Field
Summary
Types
Functions
Defines the Formex.Field struct.
:name- a field name, for example::title:type- type of field that in most cases will be name of function fromPhoenix.HTML.Form:value- the value from struct/params:required- is field required?:label- the text label:data- additional data used by particular field type (eg.:selectstores here data for<option>’s):opts- options
Creates a new field.
type is the name of function from Phoenix.HTML.Form.
Options
:label:required- defaults to true. If set, it will be validated by theEcto.Changeset.validate_required/4. Also, the template helper will it use to generate additional.requiredCSS class.:choices- list of<option>s for:selectand:multiple_selectform |> add(:select, :field, options: ["Option 1": 1, "Options 2": 2]):phoenix_opts- options that will be passed toPhoenix.HTML.Form, for example:form |> add(:textarea, :content, phoenix_opts: [ rows: 4 ])