Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Commit

Permalink
Added between/min/max conditional date validators
Browse files Browse the repository at this point in the history
Added between/min/max conditional validators on all date types (ISO,
EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)
  • Loading branch information
ghiscoding committed Mar 16, 2015
1 parent d1286a1 commit 492d106
Show file tree
Hide file tree
Showing 10 changed files with 544 additions and 132 deletions.
3 changes: 2 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
.addValidator('input11', 'date_us_long|required')
.addValidator('input12', 'time')
.addValidator('select1', 'required')
.addValidator('select2', 'required')
.addValidator({elmName: 'input13', rules: 'min_len:5|max_len:10|alpha_dash_spaces|required', validationErrorTo: ".validation-input13"})
.addValidator('input14', 'alpha|required')
.addValidator('input15', 'alpha|min_len:3|required')
.addValidator('input16', 'match:input15,Password|required')
.addValidator({elmName: 'input17', rules: 'alpha_spaces|exact_len:3|required', debounce: 5000})
.addValidator('input18', 'date_iso_min:1999-12-31|required')
.addValidator('input19', 'date_us_short_between:11/28/99,12/31/15|required')
.addValidator('area1', 'alpha_dash_spaces|min_len:15|required');


Expand Down
11 changes: 0 additions & 11 deletions change-log.txt

This file was deleted.

12 changes: 12 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Angular-Validation change logs

1.1.0 (2014-05-02): only start validating after user inactivity, it could also be passed as an argument for more customization of the inactivity timeout (typing-limit).
1.3.0 (2014-12-01): support to Angular 1.3.x
1.3.1 (2015-01-02): Added Input Match (confirmation) Validator
1.3.2 (2015-01-03): Float number validator to also permit dot (.) as first char. Also removed keyboard blocking of invalid character on input type="number" instead display error message.
1.3.3 (2015-01-04): Updated Bootstrap(3.3.1) and AngularJS(1.3.7) to latest versions
1.3.4 (2015-01-06): Removed the necessity of creating a <span> for displaying the error message, the directive now handles it by itself.
1.3.5 (2015-01-26): Throw an error message when user did not provide a name="" property inside the element to validate.
1.3.6 (2015-02-09): Added ng-strict-di for minification, renamed some files and folder lib to /vendors, moved directive into new /src folder for better separation.
1.3.7 (2015-03-08): Complete rewrite (but same functionality) so that I could add an Angular-Validation Service which is similar implementation as the Directive. Also added `debounce` attribute which is an alias to `typingLimit`, validation rules are now defined as an external service for better maintainability and also created a common file for shared functions by both Validation Directive and Service.
1.3.8 (2015-03-15): Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)
100 changes: 58 additions & 42 deletions locales/validation/en.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
{
"INVALID_ALPHA": "May only contain letters. ",
"INVALID_ALPHA_SPACE": "May only contain letters and spaces. ",
"INVALID_ALPHA_NUM": "May only contain letters and numbers. ",
"INVALID_ALPHA_NUM_SPACE": "May only contain letters, numbers and spaces. ",
"INVALID_ALPHA_DASH": "May only contain letters, numbers and dashes. ",
"INVALID_ALPHA_DASH_SPACE": "May only contain letters, numbers, dashes and spaces. ",
"INVALID_BETWEEN_CHAR": "Text must be between :param and :param characters in length. ",
"INVALID_BETWEEN_NUM": "Needs to be a numeric value, between :param and :param. ",
"INVALID_BOOLEAN": "May only contain a true or false value. ",
"INVALID_CREDIT_CARD": "Must be a valid credit card number. ",
"INVALID_DATE_EURO_LONG": "Must be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy). ",
"INVALID_DATE_EURO_SHORT": "Must be a valid date format (dd-mm-yy) OR (dd/mm/yy). ",
"INVALID_DATE_ISO": "Must be a valid date format (yyyy-mm-dd). ",
"INVALID_DATE_US_LONG": "Must be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy). ",
"INVALID_DATE_US_SHORT": "Must be a valid date format (mm/dd/yy) OR (mm-dd-yy). ",
"INVALID_EMAIL": "Must be a valid email address. ",
"INVALID_EXACT_LEN": "Must have a length of exactly :param characters. ",
"INVALID_FLOAT": "May only contain a positive float value (integer excluded). ",
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
"INVALID_IBAN": "Must a valid IBAN. ",
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \":param\". ",
"INVALID_INTEGER": "Must be a positive integer. ",
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
"INVALID_MAX_CHAR": "May not be greater than :param characters. ",
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than :param. ",
"INVALID_MIN_CHAR": "Must be at least :param characters. ",
"INVALID_MIN_NUM": "Needs to be a numeric value, equal to, or higher than :param. ",
"INVALID_NUMERIC": "Must be a positive number. ",
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
"INVALID_PATTERN": "Must be following this format: :param. ",
"INVALID_REQUIRED": "Field is required. ",
"INVALID_URL": "Must be a valid URL. ",
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
"INVALID_ALPHA": "May only contain letters. ",
"INVALID_ALPHA_SPACE": "May only contain letters and spaces. ",
"INVALID_ALPHA_NUM": "May only contain letters and numbers. ",
"INVALID_ALPHA_NUM_SPACE": "May only contain letters, numbers and spaces. ",
"INVALID_ALPHA_DASH": "May only contain letters, numbers and dashes. ",
"INVALID_ALPHA_DASH_SPACE": "May only contain letters, numbers, dashes and spaces. ",
"INVALID_BETWEEN_CHAR": "Text must be between :param and :param characters in length. ",
"INVALID_BETWEEN_NUM": "Needs to be a numeric value, between :param and :param. ",
"INVALID_BOOLEAN": "May only contain a true or false value. ",
"INVALID_CREDIT_CARD": "Must be a valid credit card number. ",
"INVALID_DATE_EURO_LONG": "Must be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy). ",
"INVALID_DATE_EURO_LONG_BETWEEN": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy) between :param and :param. ",
"INVALID_DATE_EURO_LONG_MAX": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy), equal to, or lower than :param. ",
"INVALID_DATE_EURO_LONG_MIN": "Needs to be a valid date format (dd-mm-yyyy) OR (dd/mm/yyyy), equal to, or higher than :param. ",
"INVALID_DATE_EURO_SHORT": "Must be a valid date format (dd-mm-yy) OR (dd/mm/yy). ",
"INVALID_DATE_EURO_SHORT_BETWEEN": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy) between :param and :param. ",
"INVALID_DATE_EURO_SHORT_MAX": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy), equal to, or lower than :param. ",
"INVALID_DATE_EURO_SHORT_MIN": "Needs to be a valid date format (dd-mm-yy) OR (dd/mm/yy), equal to, or higher than :param. ",
"INVALID_DATE_ISO": "Must be a valid date format (yyyy-mm-dd). ",
"INVALID_DATE_ISO_BETWEEN": "Needs to be a valid date format (yyyy-mm-dd) between :param and :param. ",
"INVALID_DATE_ISO_MAX": "Needs to be a valid date format (yyyy-mm-dd), equal to, or lower than :param. ",
"INVALID_DATE_ISO_MIN": "Needs to be a valid date format (yyyy-mm-dd), equal to, or higher than :param. ",
"INVALID_DATE_US_LONG": "Must be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy). ",
"INVALID_DATE_US_LONG_BETWEEN": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy) between :param and :param. ",
"INVALID_DATE_US_LONG_MAX": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy), equal to, or lower than :param. ",
"INVALID_DATE_US_LONG_MIN": "Needs to be a valid date format (mm/dd/yyyy) OR (mm-dd-yyyy), equal to, or higher than :param. ",
"INVALID_DATE_US_SHORT": "Must be a valid date format (mm/dd/yy) OR (mm-dd-yy). ",
"INVALID_DATE_US_SHORT_BETWEEN": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy) between :param and :param. ",
"INVALID_DATE_US_SHORT_MAX": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy), equal to, or lower than :param. ",
"INVALID_DATE_US_SHORT_MIN": "Needs to be a valid date format (mm/dd/yy) OR (mm-dd-yy), equal to, or higher than :param. ",
"INVALID_EMAIL": "Must be a valid email address. ",
"INVALID_EXACT_LEN": "Must have a length of exactly :param characters. ",
"INVALID_FLOAT": "May only contain a positive float value (integer excluded). ",
"INVALID_FLOAT_SIGNED": "May only contain a positive or negative float value (integer excluded). ",
"INVALID_IBAN": "Must a valid IBAN. ",
"INVALID_INPUT_MATCH": "Confirmation field does not match specified field \":param\". ",
"INVALID_INTEGER": "Must be a positive integer. ",
"INVALID_INTEGER_SIGNED": "Must be a positive or negative integer. ",
"INVALID_IPV4": "Must be a valid IP (IPV4). ",
"INVALID_IPV6": "Must be a valid IP (IPV6). ",
"INVALID_IPV6_HEX": "Must be a valid IP (IPV6 Hex). ",
"INVALID_KEY_CHAR": "Invalid keyboard entry on a field of type \"number\". ",
"INVALID_MAX_CHAR": "May not be greater than :param characters. ",
"INVALID_MAX_NUM": "Needs to be a numeric value, equal to, or lower than :param. ",
"INVALID_MIN_CHAR": "Must be at least :param characters. ",
"INVALID_MIN_NUM": "Needs to be a numeric value, equal to, or higher than :param. ",
"INVALID_NUMERIC": "Must be a positive number. ",
"INVALID_NUMERIC_SIGNED": "Must be a positive or negative number. ",
"INVALID_PATTERN": "Must be following this format: :param. ",
"INVALID_REQUIRED": "Field is required. ",
"INVALID_URL": "Must be a valid URL. ",
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",


"AREA1": "TextArea: Alphanumeric + Minimum(15) + Required",
Expand All @@ -48,15 +63,16 @@
"INPUT7": "IP (IPV4)",
"INPUT8": "Credit Card",
"INPUT9": "Between(2,6) Characters",
"INPUT10": "Date ISO (yyyy-mm-dd)",
"INPUT11": "Date US (long)",
"INPUT10": "Date ISO (yyyy-mm-dd)",
"INPUT11": "Date US LONG (mm/dd/yyyy)",
"INPUT12": "Time (hh:mm OR hh:mm:ss) -- NOT Required",
"INPUT13": "AlphaDashSpaces + Required + Minimum(5) Characters -- MUST USE: validation-error-to=\" \"",
"INPUT14": "Alphanumeric + Required -- NG-DISABLED",
"INPUT15": "Password",
"INPUT16": "Password Confirmation",
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
"INPUT17": "Alphanumeric + Exactly(3) + Required -- debounce(5sec)",
"INPUT18": "Date ISO (yyyy-mm-dd) -- minimum condition >= 2001-01-01 ",
"INPUT19": "Date US SHORT (mm/dd/yy) -- between the dates 12/01/99 and 12/31/15",
"SAVE": "Save",
"SELECT1": "Required (select) -- NoEVENT default(keyup) -- Directive will validate has EVENT (blur)",
"SELECT2": "Required (select) -- EVENT (blur)"
"SELECT1": "Required (select) -- validation with (blur) EVENT"
}
Loading

0 comments on commit 492d106

Please sign in to comment.