ryanzidago

ryanzidago

How to translate Phoenix default error message when `email_input` from a form is empty?

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.

Marked As Solved

ryanzidago

ryanzidago

@sfusato thanks for the info!

I decided to change the default browser message thanks to this stackoverflow post.

Also Liked

sfusato

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 is can't be blank)

For the Phoenix error messages, check priv/gettext/errors.pot

ryanzidago

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.

Last Post!

ryanzidago

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.

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
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
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement