validity
Gets a ValidityState object that contains detailed information about the validity states of the element.
Type:
NAME
TYPE
DESCRIPTION
true
if the element's custom
validity message has been set to a non-empty string.
true
if the element meets all
constraint validations.
true
if the element's
required
property is true
, but
it does not contain a value.
true
if the text input element's value
does not match its type when the type is email or url.
true
if the element's
value does not match its pattern validation.
true
if the length of the
element's value is smaller than its minlength
property.
true
if the element is
an upload button that is required and a file has been selected but not
uploaded.
true
if a text input
element's numeric value is defined as a whole number but a decimal
number is entered.
true
if the element's value
cannot be converted to a value.
true
if the element's time value
is not a valid time.
true
if the element's date value
is not a valid date.
Related Content:
Was this helpful?
Log ValidityState info
1let validityObj = $w("#myElement").validity;23let customError = validityObj.customError; // true4let valid = validityObj.valid; // false5let valueMissing = validityObj.valueMissing; // false6let typeMismatch = validityObj.typeMismatch; // false7let patternMismatch = validityObj.patternMismatch; // false8let tooLong = validityObj.tooLong; // false9let tooShort = validityObj.tooShort; // false10let rangeUnderflow = validityObj.rangeUnderflow; // false11let rangeOverflow = validityObj.rangeOverflow; // false12let fileNotUploaded = validityObj.fileNotUploaded; // false13let stepMismatch = validityObj.stepMismatch; // false14let badInput = validityObj.badInput; // false15let invalidTime = validityObj.invalidTime; // false16let invalidDate = validityObj.invalidDate; // false