{"id":29099657,"url":"https://github.com/yousef-hatem/validation-all","last_synced_at":"2026-04-18T10:38:58.320Z","repository":{"id":43388510,"uuid":"376030163","full_name":"Yousef-Hatem/validation-all","owner":"Yousef-Hatem","description":"validation using JavaScript","archived":false,"fork":false,"pushed_at":"2023-02-12T00:29:23.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T12:20:43.856Z","etag":null,"topics":["class-validator","form","form-validation","forms","input","javascript","node","validate-js","validation","validations"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yousef-Hatem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-11T13:13:30.000Z","updated_at":"2024-02-23T12:04:25.000Z","dependencies_parsed_at":"2022-07-30T16:39:06.606Z","dependency_job_id":null,"html_url":"https://github.com/Yousef-Hatem/validation-all","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/Yousef-Hatem/validation-all","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yousef-Hatem%2Fvalidation-all","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yousef-Hatem%2Fvalidation-all/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yousef-Hatem%2Fvalidation-all/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yousef-Hatem%2Fvalidation-all/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yousef-Hatem","download_url":"https://codeload.github.com/Yousef-Hatem/validation-all/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yousef-Hatem%2Fvalidation-all/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262465790,"owners_count":23315641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class-validator","form","form-validation","forms","input","javascript","node","validate-js","validation","validations"],"created_at":"2025-06-28T17:08:30.084Z","updated_at":"2026-04-18T10:38:58.244Z","avatar_url":"https://github.com/Yousef-Hatem.png","language":"JavaScript","readme":"# Validation All\n\nA library of data validation tools.\n\nThe **Validation All** library makes data validation in JavaScript very easy.\n\n## Why use Validation All?\n\n- Ease of handling and use.\n- You can validate data without writing a single line of JavaScript.\n- Using Bootstrap to display the error message.\n- ES6 support and ES5 support.\n- Control the display of messages through the **message-view** file\n\n## Installation\n\n### Using npm\n\n`npm i validation-all`\n\n### Calling the library in project\n\n#### JavaScript\n\n```js\nconst validation = require(\"validation-all\").validation;\n```\n\n#### HTML\n\n```html\n\u003cscript src=\"script/validation.min.js\"\u003e\u003c/script\u003e\n```\n\n# Basic Usage\n\nYou can do the validation with JavaScript or HTML\n\n## JavaScript\n\n```js\nvalidation(input).email(); //=\u003e true or false\n```\n\n**input** {Element} the input you want to validate and you can also replace it with data directly for example `validation('test@gmail.com').email()`\n\n**email** verification type\n\n### Options\n\n```js\nvalidation(input, {\n  required: true,\n  view: true,\n  errorMessage: \"error\",\n  correctMessage: \"correct\",\n}).email(); //=\u003e true or false\n```\n\n- **required** - Determine whether **input** is required or not\n  - The default value is `input.required`\n- **view** - Influence of **input** when true or false\n  - The default value will be `true` if the input has class `form-control`, If this class does not exist, the default value will be `false`\n- **errorMessage** - The message appears when the result is false\n  - The default value is the error message placed in the `message-view` file of \"email\" or the validation type specified\n- **correctMessage** - The message appears when the result is true\n  - The default value is the correct message placed in the `message-view` file of \"email\" or the validation type specified\n\n## HTML\n\nNotice: To use HTML only to validate the input you must be a [Bootstrap](https://getbootstrap.com) library caller\n\n```html\n\u003cform class=\"vaal-form\"\u003e\n  \u003cinput type=\"text\" class=\"form-control vaal-email\" /\u003e\n\u003c/form\u003e\n```\n\n**vaal-form** {class} This class defines that you are using validation-all in this form\n\n**vaal-email** {class} Specify the type of verification in this input\n\n### Options\n\n```html\n\u003cinput\n  type=\"text\"\n  class=\"form-control vaal-email\"\n  vaal-msg-error=\"Email is not valid\"\n  vaal-msg-correct=\"is email\"\n  required\n/\u003e\n```\n\n- **vaal-msg-error** - This message will be displayed when the value is wrong\n- **vaal-msg-correct** - This message will be displayed when the value is true\n- **required** - To make **input** required\n\n# Verification types\n\nExplanation of all verification orders\n\n## email\n\nVerify the email is correct\n\n### JavaScript Syntax\n\n```js\nvalidation(input).email(); //=\u003e true or false\n```\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"text\" class=\"form-control vaal-email\" /\u003e\n```\n\n## password\n\nTo check how hard the password is there are 3 levels of difficulty\n\n### JavaScript Syntax\n\n```js\nvalidation(input).password(); //=\u003e true or false\n```\n\n#### Options\n\n```js\nvalidation(input).password({\n  level: \"complex\",\n  resetPassword: reset,\n}); //=\u003e true or false\n```\n\n- **complex** - Required password difficulty level\n  - There are 3 levels `(simple, complex, difficult)`\n- **reset** {Element} - Input field Return password\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"password\" class=\"form-control vaal-password\" /\u003e\n```\n\n#### Options\n\n```html\n\u003cinput\n  type=\"password\"\n  class=\"form-control vaal-password\"\n  vaal-level=\"complex\"\n/\u003e\n\u003cinput type=\"password\" class=\"form-control vaal-reset-password\" /\u003e\n```\n\n- **vaal-level** - Required password difficulty level\n  - There are 3 levels `(simple, complex, difficult)`\n- **vaal-reset-password** {class} - Input field Return password\n\n## file\n\nVerify that the file exists and check the format of the file\n\n### JavaScript Syntax\n\n```js\nvalidation(input).file(); //=\u003e true or false\n```\n\n#### Options\n\n```js\nvalidation(input).file([\"png\", \"jpg\"]); //=\u003e true or false\n```\n\n- **[formulas]** {Array} Array in the required formats\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"file\" class=\"form-control vaal-file\" /\u003e\n```\n\n#### Options\n\n```html\n\u003cinput type=\"file\" class=\"form-control vaal-file\" vaal-formats=\"png,jpg\" /\u003e\n```\n\n- **[vaal-formats]** Required formats\n\n## phone\n\nVerify phone numbers\n\n### JavaScript Syntax\n\n```js\nvalidation(input).phone(\"+20\", 10); //=\u003e true or false\n```\n\n- **['+20']** Phone number key or you can type the numbers you want the phone number to start with\n  - You can also add more than one number to the beginning of the phone number `Example: ['010', '011', '012']`\n- **10** {number} The number of digits you want after the phone number key\n\n### HTML Syntax\n\n```js\n\u003cinput type=\"text\" class=\"form-control vaal-phone\" vaal-start=\"+20\" vaal-length=\"10\"\u003e\n```\n\n- **vaal-start** The phone number key is added or you can type the numbers you want the phone number to start with\n  - You can also add more than one number to the beginning of the phone number `Example: vaal-start=\"010,011,012\"`\n- **vaal-length** Specify the number of digits you want after the phone number key\n\n## url\n\nCheck URL\n\n### JavaScript Syntax\n\n```js\nvalidation(input).url(); //=\u003e true or false\n```\n\n### HTML Syntax\n\n```js\n\u003cinput type=\"text\" class=\"form-control vaal-url\"\u003e\n```\n\n## number\n\nTo check the number\n\n### JavaScript Syntax\n\n```js\nvalidation(input).number(); //=\u003e true or false\n```\n\n#### Options\n\n```js\nvalidation(input).number(min, max);\n```\n\n- **min** {number} Specify min length\n- **max** {number} Specify max length\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"text\" class=\"form-control vaal-number\" /\u003e\n```\n\n#### Options\n\n```html\n\u003cinput\n  type=\"text\"\n  class=\"form-control vaal-number\"\n  vaal-min=\"4\"\n  vaal-max=\"10\"\n/\u003e\n```\n\n- **vaal-min** {number} Specify min length\n- **vaal-max** {number} Specify max length\n\n## integer\n\nCheck that the integer\n\n### JavaScript Syntax\n\n```js\nvalidation(input).integer(); //=\u003e true or false\n```\n\n#### Options\n\n```js\nvalidation(input).integer(min, max);\n```\n\n- **min** {number} Specify min length\n- **max** {number} Specify max length\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"text\" class=\"form-control vaal-integer\" /\u003e\n```\n\n#### Options\n\n```html\n\u003cinput\n  type=\"text\"\n  class=\"form-control vaal-integer\"\n  vaal-min=\"4\"\n  vaal-max=\"10\"\n/\u003e\n```\n\n- **vaal-min** {number} Specify min length\n- **vaal-max** {number} Specify max length\n\n## checkbox\n\nTo make sure that he pressed the checkbox\n\n### JavaScript Syntax\n\n```js\nvalidation(input).checkbox(); //=\u003e true or false\n```\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"checkbox\" class=\"form-check-input vaal-checkbox\" /\u003e\n```\n\n## radio\n\nTo make sure he pressed the radio\n\n### JavaScript Syntax\n\n```js\nvalidation(input).radio(); //=\u003e true or false\n```\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"radio\" class=\"form-check-input vaal-radio\" /\u003e\n```\n\n## required\n\nMake the required input\n\n### JavaScript Syntax\n\n```js\nvalidation(input).required(); //=\u003e true or false\n```\n\n### HTML Syntax\n\n```html\n\u003cinput type=\"text\" class=\"form-control\" required /\u003e\n```\n\n## rules\n\nUsed to specify the type of verification, the maximum length and the minimum length\n\n### JavaScript Syntax\n\n```js\nvalidation(input).rules({\n  type: \"url\",\n  min: 10,\n  max: 55,\n}); //=\u003e true or false\n```\n\n- **type** Select the type of verification\n  - You can specify **string** or **number** or **integer** or **email** or **url**\n- **min** {number} Specify min length\n- **max** {number} Specify max length\n\n### HTML Syntax\n\n```html\n\u003cinput\n  type=\"text\"\n  class=\"form-control vaal-rules\"\n  vaal-type=\"url\"\n  vaal-min=\"10\"\n  vaal-max=\"55\"\n/\u003e\n```\n\n- **vaal-type** Select the type of verification\n  - You can specify **string** or **number** or **integer** or **email** or **url**\n- **vaal-min** {number} Specify min length\n- **vaal-max** {number} Specify max length\n\n# message-view\n\n- This file contains all messages used for validation\n- These messages are used when messages are not specified\n\n## Writing Validation Messages\n\nYou must first call `messageView`\n\n```js\nimport { validation, messageView } from \"validation-all\";\n```\n\nYou will create an object containing the messages you want to use\n\n```js\nvar validationMsg = {\n  checkbox: { error: \"\", correct: \"\" },\n\n  radio: { error: \"\", correct: \"\" },\n\n  email: { error: \"sorry, this email is incorrect\", correct: \"\" },\n\n  required: { error: \"this field is required\", correct: \"\" },\n\n  number: { error: \"the figure is incorrect\", correct: \"\" },\n\n  integer: { error: \"the figure is incorrect\", correct: \"\" },\n\n  file: { error: \"this file format is incorrect\", correct: \"\" },\n\n  url: { error: \"sorry, but this link is incorrect\", correct: \"\" },\n\n  phone: { error: \"sorry, but this phone number is incorrect\", correct: \"\" },\n\n  resetPassword: {\n    error: \"sorry, but the password does not match\",\n    correct: \"\",\n  },\n\n  password: {\n    simple: {\n      error: \"sorry, but the password must be at least 8\",\n      correct: \"\",\n    },\n\n    complex: {\n      error:\n        \"sorry, but the password must be at least 8 and contain letters and numbers\",\n      correct: \"\",\n    },\n\n    difficult: {\n      error:\n        \"sorry, but the password must be at least 8 and contain uppercase and lowercase letters, numbers and symbols\",\n      correct: \"\",\n    },\n  },\n};\nfor (const key in validationMsg) {\n  messageView[key] = validationMsg[key];\n}\n```\n\nThese are the default message names. You can add a new message name and use it\n\n```js\nuserName: { error: 'This username is already in use', correct: '' }\n```\n\n- **userName** {message name} It will be used to invoke the message from the object\n\n#### To use any message you have added to the object (validationMsg) Use **error** or **correct**\n\n```js\nvalidation(input).correct(\"userName\"); // =\u003e '';\nvalidation(input).error(\"userName\"); // =\u003e 'This username is already in use';\n```\n\n- **userName** I type the name of the message you want to use\n- **error - correct** If you use the error function, the error message will be displayed, and If you use the correct function, the correct message will be displayed\n- **input** the input in which the message will be displayed\n\n## License (MIT)\n\n```\nCopyright (c) 2023 Yousef Hatem \u003cyousef26hatem@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousef-hatem%2Fvalidation-all","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyousef-hatem%2Fvalidation-all","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyousef-hatem%2Fvalidation-all/lists"}