Module org.htmlunit

Interface ValidatableElement

All Known Implementing Classes:
HtmlButton, HtmlButtonInput, HtmlCheckBoxInput, HtmlColorInput, HtmlDateInput, HtmlDateTimeLocalInput, HtmlEmailInput, HtmlFieldSet, HtmlFileInput, HtmlHiddenInput, HtmlImageInput, HtmlInput, HtmlMonthInput, HtmlNumberInput, HtmlObject, HtmlOutput, HtmlPasswordInput, HtmlRadioButtonInput, HtmlRangeInput, HtmlResetInput, HtmlSearchInput, HtmlSelect, HtmlSelectableTextInput, HtmlSubmitInput, HtmlTelInput, HtmlTextArea, HtmlTextInput, HtmlTimeInput, HtmlUrlInput, HtmlWeekInput

public interface ValidatableElement
An element that supports client-side validation using the Constraint Validation API.
Author:
Ronald Brill
See Also:
  • Method Details

    • willValidate

      boolean willValidate()
      Returns whether the element is a candidate for constraint validation.
      Returns:
      whether the element is a candidate for constraint validation
    • setCustomValidity

      void setCustomValidity(String message)
      Sets the custom validity message for the element.
      Parameters:
      message - the new message
    • hasBadInputValidityState

      default boolean hasBadInputValidityState()
      Returns whether the user has provided input that the browser is unable to convert.
      Returns:
      true if the user has provided input that the browser is unable to convert
    • isCustomErrorValidityState

      boolean isCustomErrorValidityState()
      Returns whether the element has a custom validity message.
      Returns:
      true if the element's custom validity message has been set to a non-empty string by calling setCustomValidity(String)
    • hasPatternMismatchValidityState

      default boolean hasPatternMismatchValidityState()
      Returns whether the element's value does not match the specified pattern.
      Returns:
      true if the value does not match the specified pattern; if true, the element matches the :invalid CSS pseudo-class
    • isStepMismatchValidityState

      default boolean isStepMismatchValidityState()
      Returns whether the element's value does not satisfy the step constraint.
      Returns:
      true if the value does not fit the rules determined by the step attribute; if true, the element matches the :invalid and :out-of-range CSS pseudo-classes
    • isTooLongValidityState

      default boolean isTooLongValidityState()
      Returns whether the element's value exceeds the maximum allowed length.
      Returns:
      true if the value is longer than the maximum length specified by the maxlength attribute; if true, the element matches the :invalid CSS pseudo-class
    • isTooShortValidityState

      default boolean isTooShortValidityState()
      Returns whether the element's value is shorter than the minimum required length.
      Returns:
      true if the value is shorter than the minimum length specified by the minlength attribute; if true, the element matches the :invalid CSS pseudo-class
    • hasTypeMismatchValidityState

      default boolean hasTypeMismatchValidityState()
      Returns whether the element's value has a type mismatch.
      Returns:
      true if the value is not in the required syntax (for example, for email or url); if true, the element matches the :invalid CSS pseudo-class
    • hasRangeOverflowValidityState

      default boolean hasRangeOverflowValidityState()
      Returns whether the element's value exceeds the maximum allowed value.
      Returns:
      true if the value is greater than the maximum specified by the max attribute; if true, the element matches the :invalid and :out-of-range CSS pseudo-classes
    • hasRangeUnderflowValidityState

      default boolean hasRangeUnderflowValidityState()
      Returns whether the element's value is less than the minimum allowed value.
      Returns:
      true if the value is less than the minimum specified by the min attribute; if true, the element matches the :invalid and :out-of-range CSS pseudo-classes
    • isValidValidityState

      boolean isValidValidityState()
      Returns whether the element satisfies all validation constraints.
      Returns:
      true if the element is valid; if true, the element matches the :valid CSS pseudo-class, otherwise the :invalid CSS pseudo-class
    • isValueMissingValidityState

      default boolean isValueMissingValidityState()
      Returns whether the element is missing a required value.
      Returns:
      true if the element has a required attribute but no value; if true, the element matches the :invalid CSS pseudo-class