Search.../

validity

Gets a ValidityState object that contains detailed information about the validity states of the file to upload.

Type:

ValidityStateRead Only
NAME
TYPE
DESCRIPTION
customError
boolean

true if the file's custom validity message has been set to a non-empty string.

valid
boolean

true if the file to upload meets all validations.

fileNotUploaded
boolean

true if a file is required, and either no file has been selected, or a file has been selected but not uploaded.

fileSizeExceedsLimit
boolean

true if a file has been selected but it is too large. Maximum allowed file sizes are listed here.

fileTypeNotAllowed
boolean

true if a file has been selected but the file's type is not supported. Supported file types are listed here.

valueMissing
boolean

true if a file is required but no file has been selected.

typeMismatch
boolean

true if the text input element's value does not match its type when the type is email or url.

patternMismatch
boolean

true if the element's value does not match its pattern validation.

tooLong
boolean

true if the length of the element's value exceeds its maxLength property.

tooShort
boolean

true if the length of the element's value is smaller than its minlength property.

rangeUnderflow
boolean

true if the element's value is less than the its min property.

rangeOverflow
boolean

true if the element's value is more than the its max property.

stepMismatch
boolean

true if a text input element's numeric value is defined as a whole number but a decimal number is entered.

badInput
boolean

true if the element's value cannot be converted to a value.

exceedsFileLimit
boolean

true if the number of files selected exceeds the limit defined in the fileLimit property.

invalidTime
boolean

true if the element's time value is not a valid time.

invalidDate
boolean

true if the element's date value is not a valid date.

Related Content:

Was this helpful?

Log ValidityState info

Copy Code
1let validityObj = $w("#myUploadFile").validity;
2
3let customError = validityObj.customError; // true
4let valid = validityObj.valid; // false
5let fileNotUploaded = validityObj.fileNotUploaded; // false
6let fileSizeExceedsLimit = validityObj.fileSizeExceedsLimit; // false
7let fileTypeNotAllowed = validityObj.fileTypeNotAllowed; // false
8let valueMissing = validityObj.valueMissing; // false