Skip to content

Commit 89cee46

Browse files
committed
take the name from the radio input
1 parent a2c1652 commit 89cee46

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/test_dispatch/form.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ defmodule TestDispatch.Form do
5656
other_radios =
5757
radios
5858
|> Enum.uniq_by(fn {_, list, _} ->
59-
list |> Enum.find(fn {key, _} -> "name" == key end) |> elem(1)
59+
Enum.find(list, fn {key, _} -> "name" == key end) |> elem(1)
6060
end)
6161
|> Enum.reject(fn radio -> floki_attribute(radio, "name") in checked_names end)
6262

@@ -138,10 +138,11 @@ defmodule TestDispatch.Form do
138138
defp key_for_input({"button", _, _} = input, _), do: floki_attribute(input, "name")
139139

140140
defp key_for_input(input, _) do
141+
name = floki_attribute(input, "name")
141142
id = floki_attribute(input, "id")
142143

143144
if floki_attribute(input, "type") == "radio",
144-
do: String.replace_suffix(id, "_#{floki_attribute(input, "value")}", ""),
145+
do: name,
145146
else: id
146147
end
147148

0 commit comments

Comments
 (0)