formex v0.3.2 Formex.Button

Summary

Functions

Defines the Formex.Button struct

Types

t()
t() :: %Formex.Button{label: term, name: term, opts: term, phoenix_opts: term, type: term}

Functions

__struct__()

Defines the Formex.Button struct.

  • :name - a field name. By default the same as :type
  • :type - a type of a field that in most cases will be the name of a function from Phoenix.HTML.Form
  • :label - the text label
  • :opts - options
create_button(type, label, opts \\ [])

Creates a new button.

type is the name of function from Phoenix.HTML.Form. May be either :submit or :reset.

Options

  • :name - optional name of the button.

    If you added the button this way:

    form
    |> add_button(:submit, "Save")

    you can access it in the template by calling:

    <%= formex_row f, :submit %>

    But if you pass the :name option:

    form
    |> add_button(:submit, "Save", name: :special_submit)

    you can access it by this name:

    <%= formex_row f, :special_submit %>