marcandre

marcandre

Add `phx-input` binding to LiveView

I notice that most events have bindings (e.g. phx-keyup) but not the input event.

The input event is the preferred way to interact with an input. For a text input, the keyup and input events will typically correspond, but not always. Example: pressing arrow keys, or command-A triggers keyup but no input. Selecting the “Cut” or “Paste” menu items will generate an input even but no keyup.

Most Liked

chrismccord

chrismccord

Creator of Phoenix

phx-change on a form or input is effectively the input listener. (We literally bind to "input"), so phx-change should give you what you want.

LostKobrakai

LostKobrakai

Does phx-change work?

marcandre

marcandre

No, input is triggered for every changes, before they are “committed”, while change is triggered when it’s committed (e.g. you tab out the text field). That’s why I compared it to keyup; you might get a bunch of keyup before there’s a change event.
Another example, the color input presents a modal with a color wheel. It triggers input events whenever you select a color, and change only when you click on “ok”.

Where Next?

Popular in Proposals: Ideas Top

skyqrose
Proposal: I wish the socket connect/3 callback could allow returning a reply to the frontend, which would then be visible in phoenix.js ...
New
AHBruns
Rethinking phx-no-feedback So, I won’t go into how phx-no-feedback works in detail, but the tl;dr is that it lets you conditionally add a...
New
andreamancuso
Hey folks, This might sound niche, but I think it’s worth bringing up - especially given Phoenix’s reputation for being lightweight, por...
New
GenericJam
I’ve been messing around with image generation models recently and thought this could be wrapped in a library or people could just use th...
New
shahryarjb
When proposing or suggesting something please consider: As my experience implementing getBoundingClientRect as Phoenix.LiveView.JS funct...
New
superchris
Hello! After seeing a couple of posts from Chris and Jose about supporting web components in LiveView, I thought it would be great to ini...
New
bamorim
Story behind Recently, I gave a talk on a meetup about improving performance of Phoenix applications and the example app was a LiveView ...
New
zachdaniel
Something we do in various Ash packages is provide routes that the user forwards to in their own application. This is because we are deri...
New
mortenlund
Hi! Suggest to add the ability to do use the components socket as input into Phoenix.LiveView.send_update/3 function to make it easier t...
New
dvartic
Would there be interest to implement a link/1 that gives to option to operate on other events? So I implemented a simple link/1 function...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
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
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
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 43622 214
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Brian
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement