Obviously users need to add an email address to register an account.

I'm using the Bartik theme. In Firefox and Chrome, if I don't enter a value for the email address and press submit, the form is not sent; instead, I get a JS popup, "Please fill out this field."

untranslatable please fill out this field

When I search the translation UI, I can't find this string ("Please fill out this field.")

I also can't find the string when I grep for it over the entire D8 git repository.

How do I translate this string?


This message is coming from the browser and not from Drupal, so, there's not much we can do about this, except for not using HTML5 required attributes.

I have my system in French and the message comes in French, and I don't have the French language installed in my site.

Read more about this in the Drupal core issue about "HTML5 validation is not fully accessible".

EDIT: It seems that we have a working patch that solve the problem.


You can set it in Javascript with

$('input[type="text"]').setCustomValidity("This is a custom message"); 
  • The above code will give out an error in JS console: TypeError: jQuery(...).setCustomValidity is not a function; It should be called like this: jQuery('.ed_form input[type="text"]').each(function(){jQuery(this)[0].setCustomValidity("This is a custom message."); }); as setCustomValidity is not a jQuery method but a plain vanilla JS one, so it should be called against a JS object not against a a jQuery one.
    – brett
    May 21 '20 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.