Autogenerate form in a loop

I wonder if is there a way to auto generate form inputs in a loop.
I have an embedded schema with lot of checkbox fields and I I did this like that:
pe is the struct for this model passed as variable

  <%= inputs_for f, :protective_equipment_value, fn p -> %>
    <ul>
      <%=  for box <- Map.keys(@pe) do %>
        <li>
          <%= checkbox p, box %>
          <%= label p, box %>
          <%= error_tag p, box %>
        </li>
      <% end %>
    </ui>
  <% end %>

The only problem is that i have an additional id field which I can probably get rid of , and a second struct: true in this map - this needs a guard.
Is there maybe an official/less hacky way to do this??