Using validate with partial params

Adding only_touched?: false gives me a new “settings” key but without any fields. Compare to if the form has previously gone through a validate call (phx-change="validate") which sends all the form payload to get the params set up .

   
  def handle_event("choose_profile_photo", %{"file-id" => file_id}, socket) do
    # TODO: This is a temporary hack implementation, I've got an open question on the forum about how to handle this properly.
    # https://forum.elixirforum.com/t/using-validate-with-partial-params/71334
    params = AshPhoenix.Form.params(socket.assigns.form, only_touched?: false)
    dbg(params)

    socket
    |> assign(:chosen_image_id, file_id)
    |> noreply()
  end

Without a validate step:

    params #=> %{
      "_form_type" => "update",
      "id" => "47f9713d-499a-4079-b35b-adba01397a0a",
      "settings" => %{"_form_type" => "update"}
    }

With a change to “email”

params #=> %{
  "_form_type" => "update",
  "_touched" => "email,settings",
  "email" => "alex@upmailsolutions.coms",
  "id" => "47f9713d-499a-4079-b35b-adba01397a0a",
  "settings" => %{
    "_form_type" => "update",
    "_persistent_id" => "0",
    "_touched" => "_form_type,_persistent_id,_touched,_unused_date_format,_unused_first_name,_unused_profile_photo_id,_unused_time_format,_unused_timezone,date_format,first_name,profile_photo_id,time_format,timezone",
    "_unused_date_format" => "",
    "_unused_first_name" => "",
    "_unused_profile_photo_id" => "",
    "_unused_time_format" => "",
    "_unused_timezone" => "",
    "date_format" => "%d/%m/%Y",
    "first_name" => "Alex",
    "profile_photo_id" => "5",
    "time_format" => "%H:%M",
    "timezone" => "UTC"
  }
}