Class StringValidatorWithMaxLength


  • public class StringValidatorWithMaxLength
    extends Object
    Similar to StringValidator-s but these add maxlength attribute to the html tag. If you want to see this functionality in Apache Wicket vote on https://issues.apache.org/jira/browse/WICKET-1310
    Author:
    akiraly
    • Constructor Detail

      • StringValidatorWithMaxLength

        public StringValidatorWithMaxLength()
    • Method Detail

      • addMaxLengthToTag

        public static void addMaxLengthToTag​(Component component,
                                             ComponentTag tag,
                                             int maxLength)
        Adds a maxlength attribute to the tag.
        Parameters:
        component - owning wicket component
        tag - tag to add to
        maxLength - attribute value
      • exactLength

        public static StringValidator exactLength​(int length)
        Works like StringValidator.exactLength(int) but the returned validator is also adding maxlength attribute to the html tag.
        Parameters:
        length - the required length of the string
        Returns:
        the requested StringValidator
      • lengthBetween

        public static StringValidator lengthBetween​(int minimum,
                                                    int maximum)
        Works like StringValidator.lengthBetween(int, int) but the returned validator is also adding maxlength attribute to the html tag.
        Parameters:
        minimum - the minimum length of the string
        maximum - the maximum length of the string
        Returns:
        the requested StringValidator
      • maximumLength

        public static StringValidator maximumLength​(int maximum)
        Works like StringValidator.maximumLength(int) but the returned validator is also adding maxlength attribute to the html tag.
        Parameters:
        maximum - the maximum length of the string
        Returns:
        the requested StringValidator