Hi guys,
Following up on this github issue where @grych has been kindly helping:
I have been trying to get this right but still unable to make it work.
I have the basic controller, commander setup but with nested partials as follows:
Controller renders → new.html.drab template
new.html.drab template renders → form.html.drab template
the form.html.drab template renders → _invoices.html.drab template
invoices.html.drab template renders → _invoice_details.html.drab template
I am setting a drab-change event handler in a input checkbox in the last partial invoice_details.
This event handler triggers a update to a assign (po_grantotal) and this assign is located in the form.html.drab template
This are the form.html.drab template assigns:
iex(6)> socket |> assigns("form.html")
[:action, :changeset, :conn, :currency_us, :invoices, :parent, :po_grantotal]
This is a peek at that assign:
iex(7)> socket |> peek("form.html", :po_grantotal)
{:ok, 0}
So my poke call is as follows:
poke socket, "form.html", po_grantotal: 1000
With this setup I get the following error:
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range,
Ecto.Adapters.SQL.Stream, File.Stream, Floki.HTMLTree, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Scrivener.Page
, Stream, Timex.Interval
(elixir) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir) lib/enum.ex:141: Enumerable.reduce/3
(elixir) lib/enum.ex:1919: Enum.map/2
(epr) lib/epr_web/templates/payment_order/form.html.drab:76: anonymous fn/2 in EprWeb.PaymentOrderView."form.html"/1
(phoenix_html) lib/phoenix_html/form.ex:288: Phoenix.HTML.Form.form_for/4
(epr) lib/epr_web/templates/payment_order/form.html.drab:1: EprWeb.PaymentOrderView."form.html"/1
(phoenix) lib/phoenix/view.ex:332: Phoenix.View.render_to_iodata/3
(phoenix) lib/phoenix/view.ex:339: Phoenix.View.render_to_string/3
(drab) lib/drab/live.ex:683: Drab.Live.rerender_template/4
(drab) lib/drab/live.ex:638: Drab.Live.process_poke/9
Is this a correct setup? What am I doing wrong?
Thanks in advance for your help.
Best regards,