silverdr
Phx-change on both form and input level
Let’s say there’s a typical form with phx-change="validate" on the form level and there are also some fields in the form, which have phx-change="autocomplete" on input level. The problem I experience is that form level change event is not triggered whenever input level one is.
What is the correct way of handling such situations?
Most Liked
benwilson512
I think what you want is the "_target" value sent via phx-change to handle event. So if you set it at the form level, you can see which input changed via "_target" without any extra wiring.
silverdr
I thought of this too, but this way it would currently break the flow, because params contain only the one, specific input’s data rather than the full form. I’d need to rewrite the rather complex validation handler
I read those docs and it wasn’t clear to me that it is form-level EOR input-level. Now, rereading this again and looking for hints, there is one word that can suggest it to be the case: “own change event” w/o any qualifiers, although still…
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








