Operators Reference
Complete reference of all operators available for conditional logic and validation.
This reference lists all operators available in FormWork for conditional logic and validation rules.
Comparison Operators
equals (eq)
Checks if values are exactly equal.
"status" eq "active"
"count" eq 5
Supported Types: All field types
Notes:
- Case-sensitive for strings
- Type-aware (5 ≠ “5”)
not equals (neq)
Checks if values are not equal.
"status" neq "deleted"
"score" neq 0
Supported Types: All field types
greater than (gt)
Checks if value is greater than comparison.
"age" gt 18
"price" gt 100.00
"date" gt "2024-01-01"
Supported Types: Number, Date, DateTime
greater than or equal (gte)
Checks if value is greater than or equal to comparison.
"quantity" gte 1
"score" gte 80
Supported Types: Number, Date, DateTime
less than (lt)
Checks if value is less than comparison.
"quantity" lt 100
"end_date" lt "2024-12-31"
Supported Types: Number, Date, DateTime
less than or equal (lte)
Checks if value is less than or equal to comparison.
"discount" lte 50
"priority" lte 3
Supported Types: Number, Date, DateTime
Text Operators
contains
Checks if text contains a substring.
"email" contains "@company.com"
"description" contains "urgent"
Supported Types: Text, Textarea, Email, URL
Notes: Case-sensitive
not contains (not_contains)
Checks if text does not contain a substring.
"email" not_contains "test"
"name" not_contains "bot"
Supported Types: Text, Textarea, Email, URL
starts with (starts_with)
Checks if text begins with a prefix.
"phone" starts_with "+1"
"code" starts_with "PRO-"
Supported Types: Text, Textarea
ends with (ends_with)
Checks if text ends with a suffix.
"email" ends_with ".edu"
"file" ends_with ".pdf"
Supported Types: Text, Textarea, Email
matches pattern (matches_pattern)
Checks if text matches a regular expression.
"zip" matches_pattern "^\d{5}$"
"phone" matches_pattern "^\+?[\d\s-]+$"
"email" matches_pattern "^[a-z]+@company\.com$"
Supported Types: Text, Textarea, Email, URL, Phone
Regex Syntax: Uses standard regex. Special characters like {, }, [, ] need escaping with \.
Length Operators
length equals (length_eq)
Checks if value length equals a number.
"zip" length_eq 5
"code" length_eq 6
Supported Types: Text, Textarea, Array (Multiselect, Files)
length not equals (length_neq)
Checks if value length does not equal a number.
"pin" length_neq 4
length greater than (length_gt)
Checks if value length is greater than a number.
"message" length_gt 10
"selections" length_gt 0
length greater than or equal (length_gte)
"password" length_gte 8
length less than (length_lt)
Checks if value length is less than a number.
"title" length_lt 100
"tags" length_lt 5
length less than or equal (length_lte)
"name" length_lte 50
"files" length_lte 3
Boolean Operators
is true (is_true)
Checks if boolean value is true.
"agree_terms" is_true
"newsletter_opt_in" is_true
Supported Types: Toggle
is false (is_false)
Checks if boolean value is false.
"do_not_contact" is_false
Supported Types: Toggle
Empty Operators
is empty (is_empty)
Checks if field has no value.
"middle_name" is_empty
"optional_notes" is_empty
Supported Types: All field types
Notes:
- Empty string counts as empty
- 0 is NOT empty for numbers
- Empty array counts as empty
is not empty (is_not_empty)
Checks if field has a value.
"email" is_not_empty
"required_file" is_not_empty
Supported Types: All field types
Type Validation Operators
is email (is_email)
Validates email format.
"contact" is_email
Checks for: Contains @, has domain part
is URL (is_url)
Validates URL format.
"website" is_url
Checks for: Starts with http:// or https://
is number (is_number)
Checks if value is a valid number.
"quantity" is_number
Includes: Integers and decimals
is integer (is_integer)
Checks if value is a whole number.
"count" is_integer
Excludes: Decimals
is float (is_float)
Checks if value is a decimal number.
"price" is_float
is alpha (is_alpha)
Checks if value contains only letters.
"first_name" is_alpha
Includes: a-z, A-Z
Excludes: Numbers, spaces, special characters
is alphanumeric (is_alphanum)
Checks if value contains only letters and numbers.
"username" is_alphanum
Includes: a-z, A-Z, 0-9
Excludes: Spaces, special characters
Combining Operators
Logic Types
| Type | Description | Behavior |
|---|---|---|
all | AND logic | All conditions must be true |
any | OR logic | At least one condition must be true |
Nested Groups
Combine groups for complex expressions:
{
"type": "all",
"groups": [
{
"type": "any",
"rules": [
{ "field": "status", "operator": "eq", "value": "premium" },
{ "field": "orders", "operator": "gt", "value": 10 }
]
},
{
"type": "all",
"rules": [
{ "field": "country", "operator": "eq", "value": "US" }
]
}
]
}
This means: (status = premium OR orders > 10) AND country = US
Operator Quick Reference
| Operator | Symbol | Example |
|---|---|---|
| equals | eq | status eq "active" |
| not equals | neq | type neq "deleted" |
| greater than | gt | age gt 18 |
| greater or equal | gte | score gte 80 |
| less than | lt | qty lt 100 |
| less or equal | lte | price lte 50 |
| contains | contains | email contains "@" |
| not contains | not_contains | name not_contains "test" |
| starts with | starts_with | code starts_with "A" |
| ends with | ends_with | file ends_with ".pdf" |
| matches pattern | matches_pattern | zip matches_pattern "^\d{5}$" |
| length equals | length_eq | pin length_eq 4 |
| length not equals | length_neq | code length_neq 0 |
| length greater | length_gt | msg length_gt 10 |
| length greater or eq | length_gte | pwd length_gte 8 |
| length less | length_lt | title length_lt 100 |
| length less or eq | length_lte | tags length_lte 5 |
| is true | is_true | agreed is_true |
| is false | is_false | optout is_false |
| is empty | is_empty | notes is_empty |
| is not empty | is_not_empty | email is_not_empty |
| is email | is_email | contact is_email |
| is url | is_url | site is_url |
| is number | is_number | qty is_number |
| is integer | is_integer | count is_integer |
| is float | is_float | price is_float |
| is alpha | is_alpha | name is_alpha |
| is alphanum | is_alphanum | user is_alphanum |