How to create dynamic form for inputs_for?

I’m creating some input helpers for my Phoenix form according to, but I have no idea how to make one for inputs_for:

    <div class="form-group">
      <%= inputs_for f, :credential, fn cf -> %>
        <%= label cf, :password, "Password" %>
        <%= password_input cf, :password, class: "form-control" %>
        <%= error_tag cf, :password %>
      <% end %>

Anyone have experience?

All right, it’s actually very easy, here’s my answer to my question:

  def inputs(form, field, sub_field) do
    inputs_for(form, field, [], fn fp ->
      input(fp, sub_field)

And I can use it in my template like this:

<%= inputs f, :credential, :password %>