Class: ConstraintViolationMessage

ConstraintViolationMessage()

<brut-cv>

Like Message but specific to constraint violations of input fields. This accepts the name of an input field via input-name, which can be used to locate the field's localized name.

Here is how the field's name is determined:

  1. It will look for a <brut-i18n-translation> element with the key cv.fe.fieldNames.«input-name».
  2. If that's not found, it will attempt to use "this field" by locating a <brut-i18n-translation> element with the key cv.this_field (the underscore being what is used on Brut's server side).
  3. If that is not found, it will use the literaly string "this field" and emit a console warning.

Constructor

new ConstraintViolationMessage()

Properties:
Name Type Description
key string

the i18n translation key to use. It must map to the key of a <brut-i18n-translation> on the page or the element will not render any text.

input-name string

the name of the input, used to insert into the message, e.g. "Title is required".

server-side boolean

if true, this indicates the element contains constraint violation messages from the server. Currently doesn't affect this element's behavior, however AjaxSubmit will use it to locate where it should insert server-side errors.

Source:
See:

Methods

(static) i18nKey(…keyPath)

Returns the I18N key used for front-end constraint violations. This is useful if you need to construct a key and want to follow Brut's conventions on how they are managed.

Parameters:
Name Type Attributes Description
keyPath String <repeatable>

parts of the path of the key after the namespace that Brut manages.

Source: