I need to create a form for custom defined struct which has another nested struct (to be represented as formarray)
%MyOuterStruct{ key: :value,
inner_key:
%{16=> %InnerStruct{key2: :value2},
17=> %InnerStruct{key2: :value3}
}
I have defined changesets for both of these structs in their respective files.
Issue I am facing:
no function clause matching in Phoenix.HTML.Form.input_type/3
Called with 3 arguments
%{16 => %InnerStruct{key2: value}}
:inner
%{"email" => :email_input, "password" => :password_input, "search" => :search_input, "url" => :url_input}
basically in a liveview form:
...
<%= create_inner f.data.outer.inner ,:inner %>
...
and input_helpers.ex
contain
def create_inner(form, field, input_opts \\ [], data \\ []) do
type = HTML.Form.input_type(form, field) |> IO.inspect(label: "type of input")
.... more code ...
end
How do I create a custom input helper for my nested struct?