| |||||
| |||||
DocumentationGetting started Validation rules Learn by example ![]() |
Validation rulesYav currently implements these validation rules (syntax coding: rule identifier, required and optional).
alnumhyphensyntax: fieldName:nameDisplayed|alnumhyphen|msgdescription: <fieldName> must contain only a-z, A-Z, 0-9 or -_ characters. default msg: ALNUMHYPHEN_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
alnumhyphenatsyntax: fieldName:nameDisplayed|alnumhyphenat|msgdescription: <fieldName> must contain only a-z, A-Z, 0-9 or -_@ characters. default msg: ALNUMHYPHENAT_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
alphabeticsyntax: fieldName:nameDisplayed|alphabetic|msgdescription: <fieldName> must contain only a-z or A-Z characters. default msg: ALPHABETIC_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
alphanumericsyntax: fieldName:nameDisplayed|alphanumeric|msgdescription: <fieldName> must contain only a-z, A-Z or 0-9 characters. default msg: ALPHANUMERIC_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
alphaspacesyntax: fieldName:nameDisplayed|alphaspace|msgdescription: <fieldName> must contain only a-z, A-Z, 0-9, -_ or Space characters. default msg: ALPHASPACE_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
andsyntax: index of first rule|and|indexes of other rules (separator: -)|msgdescription: Defines the AND operator between two or more rules. Each rule is identified by the index in your array of rules. notes (since yav 1.4.0): Each rule used as an operand must be marked as 'andor-operator' (the old syntax with 'pre-condition' works too but is deprecated). You can use 'and' itself as a 'andor-operator'. example: 1|and|2-3|(1 and 2 and 3) not validated.
customsyntax: functionName()|customdescription: Validate to a custom rule. notes: You can create your own validation rules. Here are the steps:
example: myCustomFunction(myParameters)|custom
datesyntax: fieldName:nameDisplayed|date|msgdescription: <fieldName> must be a valid date. default msg: DATE_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes: You can change DATE_FORMAT variable in yav-config.js file to set your own date format(currently these marks are allowed: dd=day, MM=month, yyyy=year).
date_lesyntax: fieldName:nameDisplayed|date_le|dateValue|msgdescription: <fieldName> must be previous or equal to <dateValue>. default msg: DATE_LE_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes: You can use meta-values (using $ prefix char) indicating another field in your html form. Optionally, you can specify a different name to be displayed using the syntax $fieldName:nameDisplayed. You can change DATE_FORMAT variable in yav-config.js file to set your own date format(currently these marks are allowed: dd=day, MM=month, yyyy=year). examples: formerDate|date_le|01-01-2000 , formerDate|date_le|$latterDate:Latter date
date_ltsyntax: fieldName:nameDisplayed|date_lt|dateValue|msgdescription: <fieldName> must be previous to <dateValue>. default msg: DATE_LT_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes: You can use meta-values (using $ prefix char) indicating another field in your html form. Optionally, you can specify a different name to be displayed using the syntax $fieldName:nameDisplayed. You can change DATE_FORMAT variable in yav-config.js file to set your own date format(currently these marks are allowed: dd=day, MM=month, yyyy=year). examples: formerDate|date_lt|01-01-2000 , formerDate|date_lt|$latterDate:Latter date
doublesyntax: fieldName:nameDisplayed|double|msgdescription: <fieldName> must be a decimal format number (optionally starting with +-). default msg: DOUBLE_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes: You can change DECIMAL_SEP variable in yav-config.js file to set your own decimal separator.
description: <fieldName> must be a valid e-mail, or empty. default msg: EMAIL_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
emptysyntax: fieldName:nameDisplayed|empty|msgdescription: <fieldName> must be empty. default msg: EMPTY_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
equalsyntax: fieldName:nameDisplayed|equal|textValue|msgdescription: <fieldName> must be equal to <textValue>. default msg: EQUAL_MSG in yav-config.js file applicable to: hidden, text, password, textarea, checkbox, select, radio notes: You can use meta-values (using $ prefix char) indicating another field in your html form. Optionally, you can specify a different name to be displayed using the syntax $fieldName:nameDisplayed.
impliessyntax: index of precondition|implies|index of postcondition|msgdescription: Defines a dependence between two rules. Each rule is identified by the index in your array of rules. notes: The behaviour of this rule is:
integersyntax: fieldName:nameDisplayed|integer|msgdescription: <fieldName> must be an integer number (optionally starting with +-). default msg: INTEGER_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
keypresssyntax: fieldName:nameDisplayed|keypress|characters alloweddescription: <fieldName> can contain only the characters allowed, the others are disabled. default msg: none applicable to: hidden, text, password, textarea notes: add checkKeyPress(event, this, rules) function call to onkeypress event for your form field; <rules> parameter is the array with your rules. See Learn by example for a working example. This rule works with Internet Explorer, Netscape and Firefox.
maxlengthsyntax: fieldName:nameDisplayed|maxlength|intValue|msgdescription: <fieldName> must be no more than <intValue> characters long. default msg: MAXLENGTH_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
minlengthsyntax: fieldName:nameDisplayed|minlength|intValue|msgdescription: <fieldName> must be at least <intValue> characters long. default msg: MINLENGTH_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
notequalsyntax: fieldName:nameDisplayed|notequal|textValue|msgdescription: <fieldName> must be not equal to <textValue>. default msg: NOTEQUAL_MSG in yav-config.js file applicable to: hidden, text, password, textarea, checkbox, select, radio notes: You can use meta-values (using $ prefix char) indicating another field in your html form. Optionally, you can specify a different name to be displayed using the syntax $fieldName:nameDisplayed.
numericsyntax: fieldName:nameDisplayed|numeric|msgdescription: <fieldName> must contain only digits. default msg: NUMERIC_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
numrangesyntax: fieldName:nameDisplayed|numrange|min-max|msgdescription: <fieldName> must be a number in min-max range. default msg: NUMRANGE_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes:
orsyntax: index of first rule|or|indexes of other rules (separator: -)|msgdescription: Defines the OR operator between two or more rules. Each rule is identified by the index in your array of rules. notes (since yav 1.4.0): Each rule used as an operand must be marked as 'andor-operator' (the old syntax with 'pre-condition' works too but is deprecated). You can use 'or' itself as an 'andor-operator'. example: 1|or|2-3|(1 or 2 or 3) not validated.
post-conditionsyntax: a rule definition|post-conditiondescription: defines a postcondition rule. notes: See Learn by example for a working example. See implies for details.
pre-conditionsyntax: a rule definition|pre-conditiondescription: defines a precondition rule. notes: See Learn by example for a working example. See implies for details.
regexpsyntax: fieldName:nameDisplayed|regexp|regexpValue|msgdescription: <fieldName> must match to <regexpValue>. default msg: REGEXP_MSG in yav-config.js file applicable to: hidden, text, password, textarea notes: regexpValue must be a regular expression. Use '\\' instead of '\'. For example, .+@.+\\..+$ validates to a simple e-mail format.
requiredsyntax: fieldName:nameDisplayed|required|msgdescription: <fieldName> is required. default msg: REQUIRED_MSG in yav-config.js file applicable to: hidden, text, password, textarea, checkbox, select, radio notes: |
||||
|