A required
rule verifies that the field specified by the field
property has a value that is not a zero-length string.
You cannot use this rule type for file uploading fields. For file uploading fields, use the requiredfile
rule type instead.
A requiredfile
rule verifies that the field specified by the field
property has a file object value.
An email
rule verifies that the field specified by the field
property is empty or has a valid email address value.
If no format
property is specified, a valid email address is an email address that passes the is_email()
function’s test.
A url
rule verifies that the field specified by the field
property is empty or has a valid URL value.
A tel
rule verifies that the field specified by the field
property is empty or has a telephone number value.
A number
rule verifies that the field specified by the field
property is empty or has a string value representing a floating-point number.
The definition of a valid floating-point number is according to the HTML5 specification.
A date
rule verifies that the field specified by the field
property is empty or has a date value in the YYYY-MM-DD format.
A time
rule verifies that the field specified by the field
property is empty or has a time value in the hh:mm or hh:mm:ss format.
A file
rule verifies that the field specified by the field
property is empty or has a file object value.
If an accept
property is specified, the file type must match one of file types that the property defines.
An enum
rule verifies that the field specified by the field
property is empty or that it has a value exactly the same as one of the array items specified by the accept
property.
A dayofweek
rule verifies that the field specified by the field
property is empty or has a date value which is on the day of the week specified by the accept
property.
The accept
property must have an array of integer values representing the day of the week (from 1 through 7, beginning with Monday and ending with Sunday). This weekday numbering is based on ISO 8601.
A minitems
rule verifies that the field specified by the field
property has values, and the number of values is more than or equal to the number specified by the threshold
property.
A maxitems
rule verifies that the field specified by the field
property has values, and the number of values is less than or equal to the number specified by the threshold
property.
A minlength
rule verifies that the total number of characters (as UTF-16 code units) in value of the fields specified by the field
property is more than or equal to the number specified by the threshold
property.
A maxlength
rule verifies that the total number of characters (as UTF-16 code units) in value of the fields specified by the field
property is less than or equal to the number specified by the threshold
property.
A minnumber
rule verifies that the numerical value of the field specified by the field
property is equal to or greater than the number specified by the threshold
property.
A maxnumber
rule verifies that the numerical value of the field specified by the field
property is equal to or lower than the number specified by the threshold
property.
A mindate
rule verifies that the date value of the field specified by the field
property is not earlier than the date specified by the threshold
property.
A maxdate
rule verifies that the date value of the field specified by the field
property is not later than the date specified by the threshold
property.
A minfilesize
rule verifies that the size of the file object value of the field specified by the field
property is not smaller than the size specified by the threshold
property.
A maxfilesize
rule verifies that the size of the file object value of the field specified by the field
property is not larger than the size specified by the threshold
property.
A stepnumber
rule verifies that the field specified by the field
property is empty or has a numerical value that matches one of the allowed values calculated based on the base
and interval
properties. Specifically, when the field value is equal to the base value plus an integral multiple of the interval value, the rule is validated.
Both the base
and interval
properties must have an integer or a floating-point number value. The use of an any
keyword, which HTML supports as the step
attribute value, is not supported.
An all
rule verifies that all of the child rules in the rules
property are verified. Child rules are evaluated in order from the top, and if one of the rules fails, the iteration will terminate there.
The failed child rule's error
and field
properties override the parent's counterparts.
An any
rule verifies that any of the child rules in the rules
property are verified. Child rules are evaluated in order from the top, and if one of the rules passes, the iteration will terminate there.
This is the meta schema for SWV schemas based on JSON Schema.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Contact Form 7 SWV",
"description": "Contact Form 7 SWV meta-schema",
"type": "object",
"properties": {
"version": {
"type": "string"
},
"locale": {
"type": "string"
},
"rules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rule": {
"type": "string",
"enum": [
"required",
"requiredfile",
"email",
"url",
"tel",
"number",
"date",
"time",
"file",
"enum",
"dayofweek",
"minitems",
"maxitems",
"minlength",
"maxlength",
"minnumber",
"maxnumber",
"mindate",
"maxdate",
"minfilesize",
"maxfilesize",
"stepnumber",
"all",
"any"
]
},
"field": {
"type": "string",
"pattern": "^[A-Za-z][-A-Za-z0-9_:]*$"
},
"error": {
"type": "string"
},
"accept": {
"type": "array",
"items": {
"type": "string"
}
},
"base": {
"type": "string"
},
"interval": {
"type": "number",
"minimum": 0
},
"threshold": {
"type": "string"
}
},
"required": [
"rule"
]
}
}
}
}