- 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 Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether the user has provided input that the browser is unable to convert.default booleanReturns whether the element's value does not match the specified pattern.default booleanReturns whether the element's value exceeds the maximum allowed value.default booleanReturns whether the element's value is less than the minimum allowed value.default booleanReturns whether the element's value has a type mismatch.booleanReturns whether the element has a custom validity message.default booleanReturns whether the element's value does not satisfy thestepconstraint.default booleanReturns whether the element's value exceeds the maximum allowed length.default booleanReturns whether the element's value is shorter than the minimum required length.booleanReturns whether the element satisfies all validation constraints.default booleanReturns whether the element is missing a required value.voidsetCustomValidity(String message) Sets the custom validity message for the element.booleanReturns whether the element is a candidate for constraint validation.
-
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
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:
trueif 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:
trueif the element's custom validity message has been set to a non-empty string by callingsetCustomValidity(String)
-
hasPatternMismatchValidityState
default boolean hasPatternMismatchValidityState()Returns whether the element's value does not match the specified pattern.- Returns:
trueif the value does not match the specified pattern; iftrue, the element matches the:invalidCSS pseudo-class
-
isStepMismatchValidityState
default boolean isStepMismatchValidityState()Returns whether the element's value does not satisfy thestepconstraint.- Returns:
trueif the value does not fit the rules determined by thestepattribute; iftrue, the element matches the:invalidand:out-of-rangeCSS pseudo-classes
-
isTooLongValidityState
default boolean isTooLongValidityState()Returns whether the element's value exceeds the maximum allowed length.- Returns:
trueif the value is longer than the maximum length specified by themaxlengthattribute; iftrue, the element matches the:invalidCSS pseudo-class
-
isTooShortValidityState
default boolean isTooShortValidityState()Returns whether the element's value is shorter than the minimum required length.- Returns:
trueif the value is shorter than the minimum length specified by theminlengthattribute; iftrue, the element matches the:invalidCSS pseudo-class
-
hasTypeMismatchValidityState
default boolean hasTypeMismatchValidityState()Returns whether the element's value has a type mismatch.- Returns:
trueif the value is not in the required syntax (for example, foremailorurl); iftrue, the element matches the:invalidCSS pseudo-class
-
hasRangeOverflowValidityState
default boolean hasRangeOverflowValidityState()Returns whether the element's value exceeds the maximum allowed value.- Returns:
trueif the value is greater than the maximum specified by themaxattribute; iftrue, the element matches the:invalidand:out-of-rangeCSS pseudo-classes
-
hasRangeUnderflowValidityState
default boolean hasRangeUnderflowValidityState()Returns whether the element's value is less than the minimum allowed value.- Returns:
trueif the value is less than the minimum specified by theminattribute; iftrue, the element matches the:invalidand:out-of-rangeCSS pseudo-classes
-
isValidValidityState
boolean isValidValidityState()Returns whether the element satisfies all validation constraints.- Returns:
trueif the element is valid; iftrue, the element matches the:validCSS pseudo-class, otherwise the:invalidCSS pseudo-class
-
isValueMissingValidityState
default boolean isValueMissingValidityState()Returns whether the element is missing a required value.- Returns:
trueif the element has a required attribute but no value; iftrue, the element matches the:invalidCSS pseudo-class
-