anon9372508

anon9372508

Generating clientside validation on inputs from ecto schemas/changesets

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.

Most Liked

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.

Last Post!

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

Where Next?

Popular in Discussions Top

mbenatti
Following https://github.com/tbrand/which_is_the_fastest |> https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
thojanssens1
It would be nice to be able to define a redirect from one route to another from the router.ex file. E.g.: redirect "/", UserController, ...
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
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

We're in Beta

About us Mission Statement