Validator for a required field

Hello there,

this may sound stupid, but I did not find an answer to how I can mark a field in the inspector as required.
What I have is the following (heading property inside a node configuration):

  type: string
  defaultValue: 'Heading section'
    label: i18n
    inlineEditable: TRUE
    reloadIfChanged: TRUE
      group: 'content'
      editor: 'Neos.Neos/Inspector/Editors/TextFieldEditor'
        required: TRUE
    'Neos.Neos/Validation/NotEmptyValidator': []
      minimum: 1
      maximum: 255

See that I aded both validation and required. This didn’t work. Upon creation of the node I could save it without filling in the heading. As a last resort I added the default value. If you change that the validation is active.

But, can I enforce the field to be required somehow? So that you can’t save the node without it?

Thanks in advance!


The way you’ve done it is the correct way to do it, if it’s not working then maybe the configuration is incorrect in some way.

See for an example of it in the core.

it’s an inlineEditable property, for those validation doesn’t really work well as we cannot prevent an empty inline editable.

1 Like