Options
All
  • Public
  • Public/Protected
  • All
Menu

The object that contains functionality related to handling faces messages, especially validation errror messages. Contains methods for clearing message of an element or adding messages to an element.

Index

Variables

elementGroups: string[]

A list of element groups to be validated. Usually corresponds to the name of single form element. For some cases such as a select list of checkboxes, a group may correspond to multiple DOM elements.

messages: Record<string, FacesMessage[]>

A map between the client ID of an element and a list of faces message for that element.

Functions

  • addElementGroup(name: string): void
  • Adds a group to the list of element groups to validate. An element group is often just the name of a single INPUT, TEXTAREA or SELECT element, but may also consist of multiple DOM elements, such as in the case of select list of checkboxes.

    Parameters

    • name: string

      Name of an element group to add.

    Returns void

  • Adds a faces message to the given element.

    Parameters

    • element: JQuery<HTMLElement>

      Element to which to add the message.

    • msg: FacesMessage

      Message to add to the given message.

    Returns void

  • clear(): void
  • Removes all messages from this validation context.

    Returns void

  • getLabel(element: JQuery<HTMLElement>): string
  • Shortcut for PrimeFaces.validation.Utils.getLabel.

    Parameters

    • element: JQuery<HTMLElement>

      A DOM element for which to find the label.

    Returns string

    The label of the given element.

  • Shortcut for PrimeFaces.validation.Utils.getMessage.

    Parameters

    • key: string

      The i18n key of a message, such as javax.faces.component.UIInput.REQUIRED or javax.faces.validator.LengthValidator.MINIMUM.

    Returns FacesMessage | null

    The localized faces message for the given key, or null if no translation was found for the key.

  • getMessagesLength(): number
  • Reports how many messages were added to this validation context. Note that each component may have several messages.

    Returns number

    The number of messages added to this validation context.

  • isEmpty(): boolean
  • Checks whether this validation context contains any messages at all.

    Returns boolean

    true if this validation context contains zero messages, or false otherwise.

  • isGroupValidated(name: string): boolean
  • Checks whether the given element group is in the list of groups to be validated. An element group is often just the name of a single INPUT, TEXTAREA or SELECT element, but may also consist of multiple DOM elements, such as in the case of a select list of checkboxes.

    Parameters

    • name: string

      Name of an element group to check.

    Returns boolean

    true if the given group is to be validated, or false otherwise.

Generated using TypeDoc