How to insert phx-update="ignore" into function

Hi Folks,
I’m learning elixir and phoenix,

how do i put phx-update=“ignore” into my helper function?i try to find answer but I did not find any.Thanks in advance.

here my helper:

...
def multiselect_checkboxes(form, field, options, opts \\ []) do
    {selected, _} = get_selected_values(form, field, opts)
    selected_as_strings = Enum.map(selected, &"#{&1}")

    for {value, key} <- options, into: [] do
      content_tag(:label, class: "checkbox-inline") do
        [
          tag(:input,
            name: input_name(form, field) <> "[]",
            id: input_id(form, field, key),
            type: "checkbox",
            value: key,
            checked: Enum.member?(selected_as_strings, "#{key}")
          ),
          value
        ]
      end
    end
  end
...

I want to make sure all checkbox generated have phx-update=“ignore”

Pass it like an option like this:

tag(:input,
            name: input_name(form, field) <> "[]",
            id: input_id(form, field, key),
            type: "checkbox",
            value: key,
            checked: Enum.member?(selected_as_strings, "#{key}"),
            phx_update: "ignore"
          )
2 Likes