Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • findUIMessage(clientId: string, uiMessageCollection: JQuery<HTMLElement>): JQuery | null
  • For a given ID of a component, finds the DOM element with the message for that component.

    Parameters

    • clientId: string

      ID of a component for which to find the ui message.

    • uiMessageCollection: JQuery<HTMLElement>

      A JQuery instance with a list of ui-messages, or null if no such element exists.

    Returns JQuery | null

    The DOM element with the messages for the given component, or null when no such element could be found.

  • format(str: string, params: string[]): string
  • Given a message with placeholders, replaces the placeholders with the given parameters. The format of the message is similar to, but not quite the same as, the format used by java.text.MessageFormat.

    format("Value required for element {0}", ["", "email"]) // => "Value required for element email"
    format("Use {0} braces like this: '{0}'", ["", "simple"]) // => "Use simple braces like this: 'simple'"

    Parameters

    • str: string

      A message with placeholders.

    • params: string[]

      A list of parameters for the placeholders. The first item is ignored. The item at index i corresponds to the placeholder {i-1}.

    Returns string

    The string with the placeholders replaced with the given params.

  • formatBV(str: string, params: string[]): string
  • Given a message with placeholders, replaces the placeholders with the given parameters. The format of the message is similar to, but not quite the same as, the format used by java.text.MessageFormat.

    formatBV("Value required for element {0}", ["", "", "", "email"]) // => "Value required for element email"
    formatBV("Use {0} braces like this: '{0}'", ["", "", "", "simple"]) // => "Use simple braces like this: 'simple'"

    Parameters

    • str: string

      A message with placeholders.

    • params: string[]

      A list of parameters for the placeholders. The first three items are ignored. The item at index i corresponds to the placeholder {i-3}.

    Returns string

    The string, with the placeholders replaced by the given params.

  • getLabel(element: JQuery<HTMLElement>): string
  • Finds the label of a DOM element. This is either a custom label set on a component, or just the ID of the element. This label is used, for example, as part of a validation error message for the element.

    Parameters

    • element: JQuery<HTMLElement>

      A DOM element for which to find the label.

    Returns string

    The label of the given element.

  • Finds the localized text of the given message key. When the current locale does not contain a translation, falls back to the default English locale.

    Parameters

    • key: string

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

    • params: string[]

      A list of parameters for the placeholders. The first item is ignored. The item at index i corresponds to the placeholder {i-1}.

    Returns FacesMessageBase | null

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

  • Used when bean validation is enabled. Creates a faces message with the given key and for the given element. The element is used to find the label that is added to the message.

    Parameters

    • element: JQuery<HTMLElement>

      Element for which to create the message.

    • Optional defaultKey: string

      Key of the message.

    • Optional msg: string

      Default message to show. May be used to find the key of the message.

    Returns FacesMessageBase

    A faces message with the given key for the given element.

  • getSubmittedValue(element: JQuery<HTMLElement>): string
  • Given a form element (such as input, textarea, select), finds the value that would be sent when the form is submitted.

    Parameters

    • element: JQuery<HTMLElement>

      A form element for which to find its value.

    Returns string

    The value of the form element, or the empty string when it does not have a value.

  • Renders all given messages in the given container.

    Parameters

    • messages: Record<string, FacesMessageBase[]>

      The messages to render.

    • container: JQuery<HTMLElement>

      The container for the messages. Either the element with the class ui-messages, or a parent of such an element.

    Returns void

  • Given the container element of a ui message, renders the given message to that element.

    Parameters

    • uiMessage: JQuery<HTMLElement>

      The container element of the message, usually with the class ui-message.

    • msg: FacesMessageBase

      Message to render to the given element.

    Returns void

Generated using TypeDoc