ryanzidago
I have the following form:
<%= form_for @conn, Routes.auth_path(@conn, :request, "passwordless"), [method: :get], fn f -> %>
<%= hidden_input f, :redirect_url, value: Routes.page_path(@conn, :login_mail_sent) %>
<%= email_input f, :email, placeholder: "Your email address", required: :true %>
<%= submit "Log in" %>
<% end %>
Now if I try to submit the form with the email field input empty, I’ll get a small error bubble from Phoenix with something saying: “Please, fill out this field.”
Could anyone please tell me how can I translate this error message?
I know I can use gettext but I do not understand where should I call the gettext function since the string “Please fill out this field” is not written anywhere in the code.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
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
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
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
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sfusato
That bubble message you get is not from Phoenix, but from your browser (if you remove
required: :true, you will get Phoenix’s message which iscan't be blank)For the Phoenix error messages, check
priv/gettext/errors.potryanzidago
@sfusato thanks for the info!
I decided to change the default browser message thanks to this stackoverflow post.
sfusato
oninvalidonly seems to have ~38% global coverage according to caniuse.comdimitarvp
You’re better off simply providing a translated
titleattribute for the element. Much simpler and works well.ryanzidago
What do you mean exactly?
If I write:
<%= email_input f, :email, placeholder: "Your email address", required: :true, title: "Veuillez fournir votre adresse Mail" %>It still displays the English warning “Please fill out this form”.
dimitarvp
It shouldn’t say that at all, I guess you have a validation form error raised earlier than before the browser can yell at you for an invalid email field.
ryanzidago
When I remove the
required: :trueoption, I don’t get thecan't be blankmessage that @sfusato mentionend; hence why I decided to write some small javascript.That might be the reason why also the title property does not work?
Also this form is not used to create a user, it is mostly for login so it has nothing to do with Ecto (who, as far as I know, usually displays those
error this field can't be blanktype of message).dimitarvp
Very likely. For
titleto work you need not to intercept and process JS events for the element in question.If that’s not okay then I am afraid you’ll have to go all the way with JS.
sfusato
Do you have
:emailin thevalidate_required([:email])changeset function?You can still use Changesets even without a schema: check Schemaless Changesets
ryanzidago
No actually I do not use a changeset at all, just the @conn.
I’ll look into how to implement a schema less changeset.
Thanks for the tip one again.