blset

blset

Phoenix component does not trigger validate form event

Hello,

with latest liveview, inside a liveview with a form and validate event

some form input tags are in shared regular leex components, when one inputs something, that triggers the validate event round trip, and everything works well

I tried to put inside a phoenix component (not live) a checkbox input and it does not trigger a validate event when I click, so this does not work

<.comp_with checkbox />

inside the inner slot of a phoenix component, a rendered leex component does trigger the validate event
that is, this below works

<.comp1>
<%= render(View, “component.html”, …%>
</.comp1>

and finally if I try to turn the phoenix component into a live component, I cannot put it inside a phoenix component.
this below is not allowed

<.comp1>
<.live_component module=… />
</.comp1>

so it looks like only explicitly rendered components, with render call, trigger the enclosing liveview validate form event, or what’s wrong here ?

Most Liked

moogle19

moogle19

Could you maybe share some more code, e.g your complete form and the checkbox component?

Normally the “validate” event should trigger independend of the way the checkbox was added to the form.

Last Post!

blset

blset

Thanks

the setup is the following (from a pre 1.6 phoenix)
the liveview is leex and is mounted with live_render(@conn, …) from a regular html.eex template that is called from a controller
then inside the html.leex liveview

<%= form_for :response, @action,[phx_change: :validate, id: “res”], fn f → %>

<%= render ModView, “template.html” %>

<% end %>

ModView is a heex and contains the setup from my previous message
so it is not heex from the very start, maybe that explains

inside ModView, a click in a checkbox inside the component shows no round trip from the form validate event, except if it is in a eex called with explicit <%= render %>

Where Next?

Popular in Questions Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
shijith.k
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
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44167 214
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement