say I want to work with a array where the values are maps.
IE
[ %{ "foo" => "bar"}, %{ "foo" => "baz"} ]
I can get this to work with.
<input name = "post[list][][foo]" value = "bar">
<input name = "post[list][][foo]" value = "baz">
Ok so that works but what if I want to add more keys to one of the maps or both?
This is where things fall apart for me.
<input name = "post[list][][email]" value = "[email protected]">
<input name = "post[list][][primary]" value = "false">
<input name = "post[list][][email]" value = "[email protected]">
<input name = "post[list][][primary]" value = "true">
I end up with an array of 4 items like so.
[%{"email" => "[email protected]"}, %{"primary" => "false"}, %{"email" => "[email protected]"}, %{"primary" => "true"}]
When what I really wanted was an array of two items like so.
[%{"email" => "[email protected]", "primary" => "false"}, %{"email" => "[email protected]", "primary" => "true"}]
Notice that each maps has two keys email
, and primary
as the desired map. IE %{"email" => "[email protected]", "primary" => "false"}
as opose to what I ended up with which was an array of 4 maps each with one key.
Now I know this has to do with the way I named my inputs. Can anyone here help me?
FYI the context of this array and map is from Elixir.