anon9372508

anon9372508

I’m looking for feedback on my idea of how I can possibly build a solution to creating client side dom validations using a changeset.

Before you say x framework, let me just stop you right here.

The primary focus of this convo I would like to keep to that of just conceptual ideas around the following:

  • Create ecto schemas validations like we already do.
  • Generate some data that describes these validations and package that along side or in a changeset
  • Update the core components input functions to make use of this validation data and generate client side input validations like (required, minlength, pattern ect)

First has anything like this already been tried, done?
Second outside of the fanboyism for liveview/ash/hologaram/vue/svelte/x/y/z whats your take?

Personally I’m kind of shocked to not already see something that sets the required of an input by default even if just as a common pattern.

Showing Posts 1 to 6

LostKobrakai

LostKobrakai

Ecto already does that: Ecto.Changeset — Ecto v3.13.4

Those attributes have footguns as well. E.g. if you have a required attribute on an input hidden by some UI like tabs or disclosure the form simply won’t submit without any feedback to the users what’s wrong.

anon9372508

anon9372508 OP

Interesting problem. I wonder if the sensible approach to that would be in css selectors.

IE:

body:has(input:invalid:required) .global-validation-indicator {
  display: block;
}

Also how common is this that you would have hidden forms like this?

LostKobrakai

LostKobrakai

I haven’t really kept up with the state of native client side validations. This is just one I was remembering, but at least in early days there were more than just this one issue with them. And even when they work the other question is how well they compose with additional validations coming either also from the client or from the server. That doesn’t mean you should never use them, but I was trying to make a point that there are reasons for not having them as well.

Schultzer

Schultzer

The pragmatic approach is to do validation on the server, although I prefer client validation, I think the harder part is actually generalizing this, since you have a lot of different browsers. That being said, I do not believe there is any technical blockers and the question might just be about maintenance and support.

ibarch

ibarch

Yes, check out Phoenix.HTML.Form.input_validations/2

dimitarvp

dimitarvp

I’ve seen a good amount of websites deal with this simply by putting an error at the top of the form without it being attached to any input field. Some of them also auto-scrolled you to the top of the form and did a short blinking effect on the error message as well.

Not to invalidate your point, I am pointing out that it’s an old problem and enough people shrugged it off with “Well, not every error belongs to a singular field. Some errors introduce a holistic form-wide error so let’s show the users that.”.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
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
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

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
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews