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

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
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
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
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
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New

We're in Beta

About us Mission Statement