Temple v0.1.0 Temple.Form View Source

This modules wraps all of the functions from the Phoenix.HTML.Form module to make them compatible with with Temple.

Link to this section Summary

Functions

Generates an empty form tag.

Generates a form tag with a form builder and a block.

Generate a new form builder for the given parameter in form.

Please see Phoenix.HTML.Form.submit/1 for details.

Link to this section Functions

Link to this macro

checkbox(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.checkbox/3 for details.

Link to this macro

color_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.color_input/3 for details.

Link to this macro

date_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.date_input/3 for details.

Link to this macro

date_select(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.date_select/3 for details.

Link to this macro

datetime_local_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.datetime_local_input/3 for details.

Link to this macro

datetime_select(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.datetime_select/3 for details.

Link to this macro

email_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.email_input/3 for details.

Link to this macro

file_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.file_input/3 for details.

Link to this macro

form_for(form_data, action) View Source (macro)

Generates an empty form tag.

See Temple.Form.form_for/4 for more details

Link to this macro

form_for(form_data, action, opts \\ [], block) View Source (macro)

Generates a form tag with a form builder and a block.

The form builder will be available inside the block through the form variable.

This is a wrapper around the Phoenix.HTML.Form.form_for/4 function and accepts all of the same options.

Example

temple do
  form_for @conn, Routes.some_path(@conn, :create) do
    text_input form, :name
  end
end

# {:safe,
#   "<form accept-charset="UTF-8" action="/" method="post">
#      <input name="_csrf_token" type="hidden" value="AS5qfX1gcns6eU56BlQgBlwCDgMlNgAAiJ0MR91Kh3v3bbCS5SKjuw==">
#      <input name="_utf8" type="hidden" value="✓">
#      <input id="name" name="name" type="text">
#    </form>"}
Link to this macro

hidden_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.hidden_input/3 for details.

Link to this macro

inputs_for(form, field, options \\ [], list) View Source (macro)

Generate a new form builder for the given parameter in form.

The form builder will be available inside the block through the inner_form variable.

This is a wrapper around the Phoenix.HTML.Form.inputs_for/4 function and accepts all of the same options.

Example

temple do
  form_for @parent, Routes.some_path(@conn, :create) do
    text_input form, :name

    inputs_for form, :job do
      text_input inner_form, :description
    end

    inputs_for form, :children do
      text_input inner_form, :name
    end
  end
end

# {:safe,
#   "<form accept-charset="UTF-8" action="/" method="post">
#      <input name="_csrf_token" type="hidden" value="AS5qfX1gcns6eU56BlQgBlwCDgMlNgAAiJ0MR91Kh3v3bbCS5SKjuw==">
#      <input name="_utf8" type="hidden" value="✓">
#      <input id="name" name="parent[name]" type="text">
#
#      <input id="name" name="parent[job][description]" type="text">
#
#      <input id="name" name="parent[children][1][name]" type="text">
#      <input id="name" name="parent[children][2][name]" type="text">
#    </form>"}
Link to this macro

multiple_select(form, field, options, attrs \\ []) View Source (macro)

Please see Phoenix.HTML.Form.multiple_select/4 for details.

Link to this macro

number_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.number_input/3 for details.

Link to this macro

password_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.password_input/3 for details.

Link to this macro

phx_label(form, field) View Source (macro)

Please see Phoenix.HTML.Form.label/2 for details.

Link to this macro

phx_label(form, field, text_or_opts) View Source (macro)

Please see Phoenix.HTML.Form.label/3 for details.

Link to this macro

phx_label(form, field, opts, opts) View Source (macro)

Please see Phoenix.HTML.Form.label/4 for details.

Link to this macro

range_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.range_input/3 for details.

Link to this macro

reset(value, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.reset/2 for details.

Link to this macro

search_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.search_input/3 for details.

Link to this macro

select(form, field, options, attrs \\ []) View Source (macro)

Please see Phoenix.HTML.Form.select/4 for details.

Please see Phoenix.HTML.Form.submit/1 for details.

Link to this macro

submit(opts, opts) View Source (macro)

Please see Phoenix.HTML.Form.submit/1 for details.

Link to this macro

telephone_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.telephone_input/3 for details.

Link to this macro

text_area(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.textarea/3 for details.

Note: Temple defines this function as text_area with an underscore, whereas Phoenix.HTML defines it as textarea without an underscore.

Link to this macro

text_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.text_input/3 for details.

Link to this macro

time_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.time_input/3 for details.

Link to this macro

time_select(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.time_select/3 for details.

Link to this macro

url_input(form, field, opts \\ []) View Source (macro)

Please see Phoenix.HTML.Form.url_input/3 for details.