Questions tagged [phoenix-live-view]

Phoenix LiveView is a feature of Elixir's Phoenix framework that enables rendering web pages on the server via HEEx templates, and updating them via websockets / Phoenix Channels. Use this tag together with [elixir] and/or [phoenix-framework] for questions specific to this feature.

Official github repository: https://github.com/phoenixframework/phoenix_live_view

138 questions
0
votes
1 answer

Why clicking a checkbox fires a Phoenix LiveView event?

Background I have a form that has some checkboxes. This form will show checkboxes depending on a condition. After the form I have a button, which is supposed to send a phoenix event that will perform an action. However, when I click a checkbox (to…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

LiveView: How to process data in a rendered comprehension list

In Phoenix, if you need to process the data in the template, you can pass the data to the view for processing to be outputted back to the template. For example: ## index.html.heex <%= for a <- @articles do %> <%= a.title %> <%=…
Jun Dalisay
  • 1,165
  • 2
  • 12
  • 26
0
votes
1 answer

Live_helpers function usage in liveview app "live_beats" by chrismccord

There is a function sidebar_account_dropdown/1 in lib/live_beats_web/views/layout_view.ex def sidebar_account_dropdown(assigns) do ~H""" <.dropdown id={@id}> <:img src={@current_user.avatar_url}/> <:title><%= @current_user.name…
PadmaBajra
  • 23
  • 4
0
votes
1 answer

Cannot input text in text field from LiveComponent

Background I havea live component that is basically a form with a couple of text inputs and a submit button. I have the interface kinda looking the way I want, but there is a problem: I cannot input anything into the text input fields. And I have…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

How do I call an Elixir function from a Phoenix LiveView heex template passing arguments with data from socket assigns?

I'm trying to make use of the code in this blog post: [Phoenix LiveView] formatting date/time with local time zone. I confirmed (with IO.inspect) that his mount and defp code I added to a LiveView adds the socket assigns. But he doesn't give an…
Daryl Spitzer
  • 143,156
  • 76
  • 154
  • 173
0
votes
1 answer

Npm install fails for Phoenix LiveView app in Windows 10

Background I have a Phoenix app, in a fresh Windows 10 VM. In this project I cannot run npm install without errors. Problem After running npm install inside the assets directory I get the following output: λ npm install npm WARN deprecated…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

Cannot find wxWebView after wxWidgets installation

Background I am trying to run the demo app desktop-example-app showed in Elixir Berlin meetup February 2021: https://www.youtube.com/watch?v=aFpBHQ0YEw4&t=2016s I have followed all the necessary setup steps from the installation guide for…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
2 answers

Phoenix LiveView dynamic select tags in form troubles

In a phoenix LiveView form with 3 select tags, the first influences the other two, i.e. the dependent two should only display the options available for the first one, like so: <%= f = form_for @changeset, "#", id: "eval-form", phx_target: @myself,…
strokovnjaka
  • 105
  • 1
  • 7
0
votes
1 answer

How I could handle nested form action in Phoenix Live View?

So, I followwed this tutorial for creating dynamic forms: http://blog.plataformatec.com.br/2016/09/dynamic-forms-with-phoenix/ Okay, this is my actual input_helpers.ex: defmodule Conts.InputHelpers do @moduledoc """ Define <%= input f, :pass,…
Zoey
  • 474
  • 4
  • 17
0
votes
2 answers

How to send events directly from Phoenix Live View to a component

I have a question about the Phoenix LiveView Component (v0.15.4). In the documentation, there is an example code: def handle_info({:updated_card, card}, socket) do send_update CardComponent, id: card.id, board_id: socket.assigns.id {:noreply,…
Tsutomu
  • 4,848
  • 1
  • 46
  • 68
0
votes
1 answer

Conditionally rendering part of component in elixir

I am new to elixir and having trouble rendering this component in a DRY way. I have this CardHeader component
0
votes
2 answers

Send input values from root template phoenix

I have this form in my file root.html.leex, and I want to handle this event but I don't know where I must handle it!
0
votes
1 answer

In Phoenix Live View, deleting an item removes DOM element put there by a phx-hook

In a contrived chat app, I added a smiley face to a div via a phx-hook. After adding a chat, the smiley face is still there: However, after deleting the chat, the smiley disappears: How can I prevent it from disappearing?
ijt
  • 3,505
  • 1
  • 29
  • 40
0
votes
2 answers

How can I provide parameters when creating a child live view in Phoenix Live View?

In a live view I have this snippet:
<%= live_render(@socket, MyAppWeb.ChatLive.Index, id: "watch-chats", guest: @guest) %>
In ChatLive.Index I have this mount function: @impl true def mount(%{"guest_id" => guest_id},…
ijt
  • 3,505
  • 1
  • 29
  • 40
0
votes
1 answer

Count current_visitors and current_users

My Phoenix 1.5.8 LiveView application uses phx_gen_auth for the user authentication. I assign to currently logged in user to @current_user. I assign the number of current visitors (no matter if logged in or not) to @current_visitors_count. Now I…
wintermeyer
  • 8,178
  • 8
  • 39
  • 85