Taking specific fields with form.html

Good Morning…
I have a phoenix default “form.html”, which runs a select in a single column …
Ex:
controller.html
cod_client = Repo.all (from (c in Client, select: {c.fantasia_cliente, c.cod_client}))

form.html
<% = select (f,: client-orders, @cod_client, class: "form-control")%>

It works perfectly …

I’m trying to add a single query, which takes all the columns and treats it in form.html to insert only the “client_code” in the database

Ex2:

controller.html
client_completo = Repo.all (from (c in Client, select: {c.fantasia_cliente, c.cod_cliente, c.tipo_cliente, c.municipio_cliente, c.stado_cliente, c.tbpreco_cliente, c.cnpj_cliente}))

form.html
<% = select (.. @ client_completo?)%>

I hope I have not been confused.
Is there any way?

How do you want your select element look in html?

In case, it would be to show the fantasia_cliente and insert the cod_cliente

If I understand you correctly, you can request all fields you want from the database, but pass only :fantasia_cliente and :cod_cliente into the select as options.

# in controller
query = from c in Client,
  select: map(c, [
    :fantasia_cliente, :cod_cliente, :tipo_cliente,
    :municipio_cliente, :stado_cliente, :tbpreco_cliente,
    :cnpj_cliente
  ])
client_completo = Repo.all(query)
select_options = Enum.map(client_completo, fn %{fantasia_cliente: fantasia_cliente, cod_cliente: cod_cliente} ->
  {fantasia_cliente, cod_cliente}
end)

render(conn, "some.html", client_completo: client_completo, select_options: select_options)

# in "some.html.eex"
<%= select(f, :client-orders, @select_options, class: "form-control") %>