formex v0.4.4 Formex.Builder

The form builder to be used in a controller. Imported by Formex.Controller.

Example:

form = create_form(App.ArticleType, %Article{})
render(conn, "new.html", form: form)

Summary

Functions

create_form(type, struct, params \\ %{}, model \\ nil)

Creates a form struct.

Arguments

  • type - the module that implements Formex.Type behaviour, for example: App.ArticleType
  • struct - the struct that will be used in Ecto.Changeset.cast/3, for example: %App.Article{}
  • params - the parameters that will be used in Ecto.Changeset.cast/3
  • model - optional model in case if struct is nil. Used by Formex.Type.add_form/4