Formex v0.6.7 Formex.View.Nested

Helper functions for templating nested form.

See Type docs for example of use.

Summary

Functions

formex_nested(form, item_name, options \\ [], fun)

Generates a HTML for nested form

Examples of use:

  • Standard

    <%= formex_nested f, :user_info %>
  • Set a form template for nested form

    <div class="form-horizontal">
      <%= formex_nested f, :user_info, template: Formex.Template.BootstrapHorizontal %>
    </div>
  • Use your render function

    <%= formex_nested f, :user_info, fn subform -> %>
      <%= formex_row subform, :section %>
      <%= formex_row subform, :organisation_cell %>
    <% end %>
  • Template and render function

    <div class="form-horizontal">
      <%= formex_nested f, :user_info, [template: Formex.Template.BootstrapHorizontal],
        fn subform -> %>
        <%= formex_row subform, :section %>
        <%= formex_row subform, :organisation_cell %>
      <% end %>
    </div>