Custom error message for required: true

I’m building a custom block and I’d like a custom error message for one of the fields. Is it possible to set a specific message for when the user hasn’t entered anything in the field?

Here’s the default error message when a required field isn’t filled out:

There’s an error on the “Text” field in block 1 using the “Heading” block type

This error message doesn’t communicate the issue well because of how my blocks field is setup.

Here is what my blueprint for the blocks field looks like:

heroTitle:
  label: Title
  type: blocks
  required: true
  empty: No hero title yet
  max: 1
  min: 1
  fieldsets:
    - heroHeading

Since I have set the fieldsets to one block type and I have maximum number of blocks of 1, the editor doesn’t need to select a block as the block field prepopulates with the only possible block type.

If I could change the required error message to something like “The hero title field is a required, please add a title”, that would be good.

I’m aware that I can overwrite the general error message for all required fields in the translations file but this would overwrite it for other fields which I don’t want.

It’s not about the field being required itself. If it was a normal field inside a top-level fields section, you would get the error message “Please enter something” or “This field is required”. The error you are getting comes from the nesting inside a block. As a block can contain multiple invalid fields, just displaying a single error message of a single field wouldn’t work. That’s why the error message is a bit more general.

We could however improve this by listing all individual error messages in the block error dialog. Could you please create a suggestion at https://feedback.getkirby.com if you agree?