redpoll
Modal window not working properly in a for cycle heex
Hello,
Working with phx 1.6 in heex I have a cycle inside a table:
<table>
<thead>
<tr>
<th>
Something
</th>
<th>
modals
</th>
<tr>
</thead>
<tbody>
<%= for user <- @users do %>
<!-- some tr -->
<td>
Open Modal
</td>
<div id="myModal" class="hidden modal">
<!-- Modal things -->
</div>
</tbody>
Now, the problem is not with the modal itself. Clicking on Open Modal for first row, eg index 0, the modal opens, but clicking on the second Open Modal generated by the for cycle <%= for user <- @users do %> exactly nothing happens.. Why? It seems as the js for the modal only works for index 0..
The modal must stay in the for cycle because I have a form inside it using user variables. Just to say - I have removed all tailwind classes for simplify
Ideas?
Marked As Solved
LostKobrakai
Makre sure your modals have unique ids. Using an id more than a single time is invalid in html.
2
Popular in Discussions
I would like to better understand what the advantages/disadvantages of umbrella applications are compared to structuring your app as as s...
New
A big advantage to Elixir is all the distributed goodness but for many applications running on multiple nodes having integrated Etcd, Zoo...
New
Hi all,
I am trying to convince my team to use liveview over the current react. What are some of the points where one should consider us...
New
The upcoming Phoenix 1.6 release looks very interesting. Became a habit to watch the commits - and - what they are bringing in.
phx.gen...
New
AWS re:Invent is on at the moment with some interesting announcements. One new feature in particular is the Lambda Runtime API for AWS La...
New
I recently came across the javascript library htmx. It reminded me a lot of liveview so I thought the community here might be interested....
New
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them?
Feel free to be as concise or in-depth as you li...
New
Hey guys!
I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things.
But I don’t think this is ...
New
Other popular topics
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New









