formex v0.5.3 Formex.Form

Summary

Functions

Defines the Formex.Form struct

Finds form item by name

Returns list of items which can be validated (all except the Button)

Adds field to the form. More: Formex.Field.create_field/4, Button.create_button/3

Types

t()
t() :: %Formex.Form{errors: term, items: term, method: term, new_struct: term, opts: term, params: term, phoenix_form: term, struct: term, struct_info: term, struct_module: term, submitted?: term, template: term, template_options: term, type: term, valid?: term}

Functions

__struct__()

Defines the Formex.Form struct.

  • :type - the module that implements Formex.Type, for example: App.ArticleType
  • :struct - the struct of your data, for example: %App.Article{}
  • :new_struct - the :struct with :params applied
  • :struct_module - struct.__struct__, for example: App.Article
  • :struct_info - additional info about struct, that can differs between implementations of Formex.BuilderProtocol
  • :items - list of Formex.Field and Button structs
  • :params - sent parameters
  • :phoenix_form - %Phoenix.HTML.Form{}
  • :template - the module that implements Formex.Template, for example: Formex.Template.BootstrapHorizontal. Can be set via a Formex.View.formex_form_for options
  • :method - :post, :put etc. May be used by Formex.View. E.g. Formex.Ecto.Builder sets here :put if we editing struct, :post otherwise.
  • :submitted? - is form submitted? Set by Formex.Controller.handle_form/1
  • :opts - additional data passed in a controller. See: Formex.Builder.create_form/5
find(form, name)
find(form :: t, name :: atom) :: list

Finds form item by name

finish_creating(form)
finish_creating(form :: Formex.Form.t) :: Formex.Form.t
get_collections(form)
get_collections(form :: t) :: list

Returns list of Formex.FormCollection.t/0

get_fields(form)
get_fields(form :: t) :: list

Returns list of Formex.Field.t/0

get_fields_validatable(form)
get_fields_validatable(form :: t) :: list

Returns list of items which can be validated (all except the Button)

get_nested(form)
get_nested(form :: t) :: list

Returns list of Formex.FormNested.t/0

get_subforms(form)
get_subforms(form :: t) :: list

Returns list of Formex.FormNested.t/0 and Formex.FormCollection.t/0

put_item(form, item)
put_item(form :: t, item :: any) :: t

Adds field to the form. More: Formex.Field.create_field/4, Button.create_button/3

start_creating(form, type, name, opts \\ [])
start_creating(form :: Formex.Form.t, type :: any, name :: Atom.t, opts :: Map.t) :: Formex.Form.t