marcandre

marcandre

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.

Showing Posts 1 to 6

LostKobrakai

LostKobrakai

Does phx-change work?

marcandre

marcandre OP

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”.

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.

marcandre

marcandre OP

:exploding_head: Oh, you are both right, thanks. TIL.

Note that I couldn’t find this information anywhere in the doc.

Please consider renaming the hook phx-input as it is literally what it does. Looking at the source, there’s binding on both “input” and “change”, with de-dupping that should actually never use the “change” binding, unless the user triggers manually a “change” event without an “input” event to precede it (in which case the next “input” event will actually be wrongly ignored by phoenix)

marcandre

marcandre OP

I believe this PR fixes the potential minor issue I was mentioning.

magiclouie

magiclouie

I am with you.

Your observation about renaming the phx-change to phx-input makes sense, considering the underlying binding to the “input” event. It would also provide clarity and consistency for developers when reading the code and documentation.

— All posts loaded —

Where Next? Top

Trending in Proposals: Ideas Top

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews