Multiple values on phx-click phx-value- not being assigned to handle_event

I want to send multiple values using the phx-click, I was going to send all the values in the same phx-value as string separating the values with : … Then I found the new documentation stating that it is possible to send multiple values using phx-value-valuename and receiving the values in the handle event as a map, but it is not working, at least for me.

Environment

  • Elixir version (elixir -v): 1.9
  • Phoenix version (mix deps): 1.4.10
  • NodeJS version (node -v): v8.10.0
  • NPM version (npm -v): 3.5.2
  • Operating system: Ubuntu 18.04.1 LTS

Actual behavior

(FunctionClauseError) no function clause matching in handle_event/3
handle_event(“inc”, “”, %{struct: Phoenix.LiveView.Socket, assigns: …

Expected behavior

As documentation on phx-value- should send the values myvar and mvar2(typo in documentation) to the handle event inc

def handle_event(“inc”, %{“myvar1” => “val1”, “myvar2” => “val2”}, socket) do

Well… this is embarrassing, so if anyone else happens to encounter this error remember to npm install to update your live view js lib…

4 Likes