Validator-Type Reference
blank
What it does
Check if field is blank
Errors If
Field is left blank or only whitespace characters are present in it's value
Parameters
Notes
Whitespace characters include Space, Tab, Carriage Return, Newline, Formfeed
bok
Demo Form
Applicable Elements
In File
fValidate.basic.js
length
What it does
Validates to a minimum length.
Errors If
Field value is shorter than minimum length specified or field is left blank.
Parameters
- min
- Integer Optional - Sets minimum allowed length
- maxLen
- Integer Optional - Sets maximum allowed length
Notes
Any paramter entered as a negative will be converted to a positive before use.
bok
Demo Form
Applicable Elements
In File
fValidate.basic.js
equalto
What it does
Validate equality with a 2nd field.
Errors If
Field value is shorter than minimum length specified or field is left blank.
Parameters
- otherObjName
- String Required - Name or id of other form element to be equal to
bok
Demo Form
Applicable Elements
In File
fValidate.logical.js
number
What it does
Validate integers and floats.
Errors If
Field value is shorter than minimum length specified or field is left blank.
Parameters
- type
- Boolean Optional -
- 0
- For integers
- 1
- For floats
- lb
- Integer Optional - Lower bound (minimum accepted value)
- ub
- Integer Optional - Upper bound (maximum accepted value)
bok
Demo Form
Applicable Elements
In File
fValidate.numbers.js
numeric
What it does
Validate numbers as strings.
Errors If
Field contains any non-digit characters or field is left blank
Parameters
- min
- Integer - Sets minimum length
bok
Demo Form
Applicable Elements
In File
fValidate.numbers.js
alnum
What it does
Validates alphanumeric text to specified rules
Errors If
Field contains any characters other than a-z or A-Z or 0-9 (if set) or does not meet minimum length or has trailing or leading spaces or has invalid punctuation or field is left blank
Parameters
- min
- Integer Optional - Sets minimum length
- case
- String Optional - Sets case rules
- a or A
- Any case accepted
- u or U
- UPPERCASE
- l or L
- lowercase
- c or C
- Initial capital
- numbers
- Boolean Optional - Sets whether or not numbers are allowed.
- false
- Numbers aren't allowed
- true
- Numbers are allowed
- spaces
- Boolean Optional - Sets whether or not spaces are allowed.
- false
- Spaces aren't allowed
- true
- Spaces are allowed
- puncs
- String Optional - Sets what punctuation characters are allowed.
- any
- Any punctuation is allowed
- none
- No punctuation allowed
- Any String of allowed punctuation
- Specified string of punctuation allowed
bok
Applicable Elements
In File
fValidate.extended.js
decimal
What it does
Validates a simple decimal format
Errors If
Field data does not match decimal format specified or is left blank
Notes
Wildcards (*) can be used for either parameter, specifying any number of digits for that side
Parameters
- leftDigits
- Integer Optional - Sets exact number of digits that must appear to the left of the decimal
- rightDigits
- Integer Optional - Sets exact number of digits that must appear to the right of the decimal
bok
Demo Form
Applicable Elements
In File
fValidate.numbers.js
decimalr
What it does
Validate a complex decimal format.
Errors If
Field data does not match decimal format specified or is left blank.
Parameters
- leftDigitsMin
- Integer Optional - Sets minimum number of digits that must appear to the left of the decimal
- leftDigitsMax
- Integer Optional - Sets maximum number of digits that must appear to the left of the decimal
- rightDigitsMin
- Integer Optional - Sets minimum number of digits that must appear to the right of the decimal
- righttDigitsMax
- Integer Optional - Sets maximum number of digits that must appear to the right of the decimal
Notes
Wildcards (*) can be used for any parameter, specifying any number of digits for that value.
bok
Demo Form
Applicable Elements
In File
fValidate.numbers.js
ip
What it does
Validate an IP addres.
Errors If
Field does not match the standard IP addess format of xxx.xxx.xxx.xxx or port number is out of specified bounds or field is left blank.
Parameters
- portMin
- Integer Optional - Sets lowest port number allowed
- portMax
- Integer Optional - Sets highest port number allowed
bok
Demo Form
Applicable Elements
In File
fValidate.web.js
ssn
What it does
Validate a US Social Security Number.
Errors If
Field does not match the standard SSN format of XXX-XX-XXXX or field is left blank.
Parameters
bok
Demo Form
Applicable Elements
In File
fValidate.extended.js
money
What it does
Validate US currency (or similar) format.
Errors If
Field data does not match money format specified or is left blank.
Parameters
- ds
- String Optional - Specifies "dollar sign" character required.
- grp
- String Optional - Specifies "grouping" character required.
- dml
- String Optional - Specifies "decimal" character required.
Notes
Any parameter that is left blank will exclude that format requirement from validation.
bok
Demo Form
Applicable Elements
In File
fValidate.ecommerce.js
cc
What it does
Validates credit card input.
Errors If
If card number entered doesn't match establish card rules or doesn't validate against the LUHN checksum or is left blank.
Parameters
Notes
Make sure you property setup a ccType element as defined in the config for the cc validation. Also note that the acceptable option values for this element are VISA, MC, DISC, AMEX, DINERS, ENROUTE, JCB, Switch, Delta, and Solo.
bok
Demo Form
Applicable Elements
In File
fValidate.ecommerce.js
zip
What it does
Validate US Zip Code (regular or +4).
Errors If
Field data does not match the valid US 5 digit or Zip+4 format or is left blank
Parameters
- sep
- String Optional - Character(s) that separate the two sets of digits.
bok
Demo Form
Applicable Elements
In File
fValidate.extended.js
phone
What it does
Validate US-style phone number.
Errors If
Field data does not match a valid US phone number format (10 or 7 digit) or is left blank.
Parameters
- format
- Integer Optional - Sets strictness of format adherence
- 0
- Loose format - parens, dashes, and area-code are optional.
- 1
- Strict format - parens, dashes, and area-code are required.
bok
Demo Form
Applicable Elements
In File
fValidate.extended.js
What it does
Validate an email address.
Errors If
Field data does not match a valid email format or is left blank.
Parameters
- level
- Integer Optional - Sets strictness level of format adherence
- 0
- Least strict
- 1
- Medium-low strict
- 2
- Medium-high strict
- 3
- Most strict
bok
Demo Form
Applicable Elements
In File
fValidate.web.js
url
What it does
Validate a URL.
Errors If
Field data does not match a valid URL format or is left blank.
Parameters
- hosts
- String Optional - A comma-separated list of allowed hosts
- http
- Allow domains only from this host.
- http,https,ftp
- If you wanted to include several hosts.
- hostOptional
- Boolean Optional - Indicates whether or not the host is required for the URL to validate.
- allowQS
- Boolean Optional - Indicates whether or not a query-string may exist on the URL to be validated.
bok
Demo Form
Applicable Elements
In File
fValidate.web.js
date
What it does
Validate a date for format and time-relation.
Errors If
Field data is not a correctly formatted date, or is before or after specDate or is left blank
Parameters
- formatStr
- String Required - Format expected for date. Use foward slash to separate parts.
- mm/dd/yyyy
- US et al date format.
- dd/mm/yyyy
- European date format.
- yyyy/mm/dd
- Universal date format.
- delim
- String Optional - The delimeter(s) you wish to allow for separating date pieces
- /
- Standard foward-slash.
- -/
- Allows the hyphen OR the forward-slash
- code
- Integer Optional - A code used to validate time reference to specDate.
- 0
- Time relation is not used in validation.
- 1
- Date must be before date acquired by specDate.
- 2
- Date must be on or before date acquired by specDate.
- 3
- Date must be after date acquired by specDate.
- 4
- Date must be on or after date acquired by specDate.
- specDate
- String Optional - The date used to compare against entered date for time-relation.
- today
- Uses current day for comparison.
- JSDate
- Any javascript date-object compatible string-representation of a date.
- elementName
- The name of another element in the same form who's value is a date for comparison.
bok
Demo Form
Applicable Elements
In File
fValidate.datetime.js
select
What it does
Validate a select object for a selected index past 0.
Errors If
Initial index (0) of the select object is selected (indicating no change made).
Parameters
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
selectm
What it does
Validate a multiple-select for the quantity selected.
Errors If
Number of selected options does not fall within specified min/max values.
Parameters
- minS
- Integer Required - Minimum number of selections required.
- maxS
- Mixed Optional - Maximum number of selections allowed.
- *
- Wildcard - no maximum.
- 999
- Alias for the wildcard
- Any Integer
- If a higher number than the quantity of options available, default is used.
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
selecti
What it does
Validate a select against a list of restriced indexes.
Errors If
The selected index matches one of those in the restricted list.
Parameters
- indexes
- String Required - A comma-separated list of indexes that are not valid selections.
Notes
Remember, the indexes of select element options are zero-based.
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
checkbox
What it does
Verify that a certain number of boxes have been checked.
Errors If
Number of checked options does not fall within specified min/max values.
Parameters
- minC
- Integer Required - Minimum number of selections required.
- maxC
- Mixed Optional - Maximum number of selections allowed.
- *
- Wildcard - no maximum.
- 999
- Alias for the wildcard
- Any Integer
- If a higher number than the quantity of boxes available, default is used.
Notes
You only need to place validator attribute on the first checkbox in the array.
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
radio
What it does
Verify that one button in the group has been ticked.
Errors If
None of the buttons in the radio-button group are checked.
Parameters
Notes
Only put the validator attribute on the first button in the group.
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
comparison
What it does
Compare two fields using any logical comparison operator.
Errors If
If the expression between the two fields yields false
Parameters
- field1
- String Required - The name of the element that field2 will be compared against.
- operator
- String Required - The operator used to compare the field1's value with field2's value.
- >
- Greater than
- <
- Less than
- >=
- Greater than or equal to
- <=
- Less than or equal to
- ==
- Equal to
- !=
- Not equal to
- field2
- String Required - The name of the element for field1 to be compared to.
Notes
The expression is evaluated in this manner
field1 operator field2
If the outcome of the expression is false, the validation will fail.
bok
Demo Form
Applicable Elements
In File
fValidate.logical.js
eitheror
What it does
Ensure that one and only one field has data.
Errors If
All of the specified fields are blank or more than 1 of the specified fields contains data.
Parameters
- delim
- String Required - Delimeter you intend to used in seperated list of field-names.
- fields
- String Required - delim-separated list of element names (must be in the same form) to include in this validation.
Notes
To my knowledge, there is no practical limit to the number of fields that you can include with eitheror. The hidden input that receives the validation attribute must have a name or id specified for this to function. Since the eitheror validator is attached to a separate hidden field, each of the included fields can still have it's own validator, but must be modified with bok. You must place the hidden input with the eitheror validator after all the inputs in its list. The hidden field must have a name attribute for the box error mode to function properly. At this time, eitheror's logical check is only compatible with text-based form elements.
bok
Demo Form
Applicable Elements
In File
fValidate.logical.js
atleast
What it does
Ensures that there is data in at least n fields.
Errors If
Fewer than the specified number of fields have data.
Parameters
- qty
- Integer Required - Validate for at least this many fields.
- delim
- String Required - Delimeter you intend to used in seperated list of field-names.
- fields
- String Required - delim-separated list of element names (must be in the same form) to include in this validation.
Notes
To my knowledge, there is no practical limit to the number of fields that you can include with atleast. The hidden input that receives the validation attribute must have a name or id specified for this to function. Since the atleast validator is attached to a separate hidden field, each of the included fields can still have it's own validator, but must be modified with bok. You must place the hidden input with the atleast validator after all the inputs in its list. The hidden field must have a name attribute for the box error mode to function properly. At this time, atleast's logical check is only compatible with text-based form elements.
bok
Demo Form
Applicable Elements
In File
fValidate.logical.js
allornone
What it does
Ensures that either all of the fields int he list have data, or none of the fields in the list have data.
Errors If
Only some of the fields in the list have data.
Parameters
- delim
- String Required - Delimeter you intend to used in seperated list of field-names.
- fields
- String Required - delim-separated list of element names (must be in the same form) to include in this validation.
Notes
To my knowledge, there is no practical limit to the number of fields that you can include with allornone. The hidden input that receives the validation attribute must have a name or id specified for this to function. Since the allornone validator is attached to a separate hidden field, each of the included fields can still have it's own validator, but must be modified with bok. You must place the hidden input with the allornone validator after all the inputs in its list. The hidden field must have a name attribute for the box error mode to function properly. At this time, allornone's logical check is only compatible with text-based form elements.
bok
Demo Form
Applicable Elements
In File
fValidate.logical.js
file
What it does
Restricts file entered to specified filetypes
Errors If
File entered is not of valid type as specified or is left blank
Parameters
- extensions
- String Required - A comma-separated list of allowed file extensions.
- zip,jpg,pdf
- Allows JPEG, ZIP archive, and PDF files.
- cSens
- Boolean Optional - Indicates whether or not extension-matching should be case-sensitive. This will rarely need to be changed from the default false.
bok
Demo Form
Applicable Elements
In File
fValidate.controls.js
custom
What it does
Allows for custom application of regular expression patterns.
Errors If
If pattern test fails.
Parameters
Notes
Write patterns normally. Don't double-escapce meta-characters.
bok
Demo Form
Applicable Elements
In File
fValidate.special.js
cazip
What it does
Validates Canadian postcodes
Errors If
Field value is not a valid Canadian postcode or is left blank.
Parameters
Notes
This validator has an alias inside fValidate called capost.
bok
Demo Form
Applicable Elements
In File
fValidate.international.js
ukpost
What it does
Validates UK postcodes.
Errors If
Field value is not a valid UK postcode or is left blank.
Parameters
bok
Demo Form
Applicable Elements
In File
fValidate.international.js
germanpost
What it does
Validates German postcodes.
Errors If
Field value is not a valid German postcode or is left blank.
Parameters
bok
Demo Form
Applicable Elements
In File
fValidate.international.js
swisspost
What it does
Validates Swiss postcodes.
Errors If
Field value is not a valid Swiss postcode or is left blank.
Parameters
bok
Demo Form
Applicable Elements
In File
fValidate.international.js