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
1
vote
0 answers

Disappearing selects after live view reload

I've got a strange problem occurring in my LiveView render. Here is what happens as a flow: I choose any not default option from first select, leaving second select default -> I submit my search form to LiveView -> On the reloaded screen with new…
Kaquadu
  • 21
  • 4
0
votes
0 answers

Enable/disable a button in Phoenix 1.7 depending on state

Background I have a button that may be disabled or not, depending on a set of conditions. I want to disable/enable the button without having to reload the page. To achieve this I am using the following code: my_app_live.ex #provided as a sample def…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

current_user is not available on the socket, even though it's assigned through `on_mount HealthTrackerWeb.UserLiveAuth`

I've built a simple CRUD app that can be used to track health metrics like Weight. I've followed the official guide to access current_user from the socket. That allowed me to reach out to socket.assigns.current_user.id whenever I need. But…
martins
  • 9,669
  • 11
  • 57
  • 85
0
votes
1 answer

How to make checkbox work with form bindings Phoenix LV?

Background I have a LiveView page where I have a small form. This form is supposed ton have a group of radio buttons, and a group of checkboxes. To achieve this, I am trying to use Form…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

How to move html code from a component function into an html/heex partial?

Let's say I have something like this: defmodule MyAppWeb.Live.PostComponents do use Phoenix.Component use Phoenix.HTML def card(assigns) do ~H"""
0
votes
0 answers

left and bottom values are not being recognised when using absolute position in Phoenix Liveview html template

I am trying to build a simple car race game using Phoenix Liveview / tailwind CSS and I have the below html template function cars() called by the render() function to display 6 cars at their respective initial positions. For every car, the…
Rajenth
  • 1
  • 2
0
votes
2 answers

How to get app.html.heex to use assigns properly with LiveView

Background I have a Phoenix application, where all pages (expect the login page) have a menu at the top. This menu will therefore only appear if the user has already logged in. I am trying to replicate this behaviour, by incorporating said menu in…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
0 answers

Phoenix 1.7 and dynamic layout parts

One gotcha with new Phoenix 1.7 for me has been the dynamic parts of the layouts, i.e. meta tags for descriptions, preloading, canonical and whatnot. Open graph tags. Also optional JS scripts for things like AdSense or some captcha. And many…
NoDisplayName
  • 15,246
  • 12
  • 62
  • 98
0
votes
0 answers

Can't find page_live.html.leex in my phoenix project folder

I'm following this tutorial for a Phoenix live chat: https://www.youtube.com/watch?v=fyg0FuSL5DY&t=280s. In the video the guy goes to a file called page_live.html.leex to edit the webpage content, but I can't seem to find the file in my own project…
Pickle
  • 27
  • 1
  • 7
0
votes
1 answer

Changing endpoint.ex to “use Desktop.Endpoint” breaks Desktop app

Background I have created a fresh Phoenix app using mix phx.new.web web_interface --no-dashboard --no-ecto --no-gettext --no-mailer inside an Umbrella app. After following the basic installation instructions for the dependencies and changing my…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
0
votes
1 answer

Updating state multiple times from a handle_event

Is there a way to trigger a re-render with an updated state multiple times from a handle_event call? Here's some vague idea of what I'm trying to do: def handle_event("button_clicked", %{button: which_button}, socket) do …
voxobscuro
  • 2,132
  • 1
  • 21
  • 45
0
votes
0 answers

Phoenix LiveView add/update schema is using POST instead of Websockets

I created a toy app using Phoenix/LiveView. I used the generators to create things. It's possible I messed with routes. The app is a simple CRUD, list-o-stuff application. Nothing tricky. I can see the list of sets (my schema/struct). I can open up…
jaydel
  • 14,389
  • 14
  • 62
  • 98
0
votes
2 answers

Where is the controller for app.html.heex?

I am trying to create a menu in Phoenix that has a list based on a database query. ## app.html.heex
    ## @items = MyApp.Items.Item.list_items <%= for item <- @items do %>
  • <%= item.name %>
  • <% end %> ... The menu is…
Jun Dalisay
  • 1,165
  • 2
  • 12
  • 26
0
votes
0 answers

How to start a new, blank Elixir Phoenix LiveView project in a docker container when host cannot run Phoenix?

My host is Debian, and I'd like to start a new LiveView project where I don't already have any code or mix.exs. I can't run mix phx.new from the host because Phoenix won't install w/o more up to date versions of Elixir than Debian stable ships with,…
0
votes
0 answers

to make a handle event that handles a toggle button responsible for adding or removing permissions from a role while creating or editing a role

I have a phoenix live component that adds and edits new roles, the component also has toggles for adding and removing permissions from a role while editing or creating a role I tried using permission ids to populate or depopulating an existing list…