Interface IPluginValidationRule

  • All Superinterfaces:
    IFCPlugin, INamedUiElement, INameProviding, ITransferable, Serializable

    public interface IPluginValidationRule
    extends IFCPlugin
    Interface for validation rule plugins. A validation rule can be used to add additional data types for text input elements. For each text input element, the user can select one data type. When the user enters a value into an input element and that value does not conform to the data type, the input element is considered invalid an an appropriate error message is shown to the user.

    Each validation rule specifies a (JavaScript) regular expression that is checked against the value of the text input field. When the regular expression does not match, the value is considered invalid. Each validation rule must also specify an error message that is shown to the user in case the value is invalid.

    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • getKeyDisplayName

        String getKeyDisplayName​(Locale locale)
        Parameters:
        locale - The current locale of the designer.
        Returns:
        The name of this validation rule. This is what is shown as the name for this validation rule in the FORMCYCLE designer.
      • getRegex

        String getRegex()
        This must return the JavaScript regular expression that check whether the value of form field is valid. Please note that the regular expression must include the initial and final slash. For example an check for an ISBN-10 number could be written as:
         /^(?=[-0-9xX ]{13}$)(?:[0-9]+[- ]){3}[0-9]*[xX0-9]$/
         
        Furthermore, you usually want to the include the start-of-string marker ^ and end-of-string marker $ to make sure the regular expression matches the entire string, not only a part of it

        The value of a form field is considered valid if this regular expression matches that value; and invalid otherwise. When the value of a form field is invalid, an appropriate error message is shown to the user.

        Returns:
        A JavaScript regular expression, including the initial and final slash.
      • getValidationErrorMsg

        String getValidationErrorMsg​(Locale locale)
        Parameters:
        locale - Current locale for which to show the error message.
        Returns:
        The error message that is shown to the user when they enter an invalid value in a form element.