diff --git a/lib/phoenix_html/form.ex b/lib/phoenix_html/form.ex index dbbda53..4c4964f 100644 --- a/lib/phoenix_html/form.ex +++ b/lib/phoenix_html/form.ex @@ -334,17 +334,25 @@ defmodule Phoenix.HTML.Form do [acc | option(option_key, option_value, [], selected_values)] options, acc when is_list(options) -> - {option_key, options} = Keyword.pop(options, :key) - - option_key || - raise ArgumentError, - "expected :key key when building ) <> - ~s() + ~s() <> + ~s() assert options_for_select(["value", :hr, "novalue"], "novalue") |> safe_to_string() == ~s() <> @@ -261,14 +262,16 @@ defmodule Phoenix.HTML.FormTest do [ [value: "value", key: "Value", disabled: true], :hr, - [value: "novalue", key: "No Value"] + [value: "novalue", key: "No Value"], + [value: nil, key: nil] ], "novalue" ) |> safe_to_string() == ~s() <> ~s(
) <> - ~s() + ~s() <> + ~s() assert options_for_select(~w(value novalue), ["value", "novalue"]) |> safe_to_string() == ~s() <>