{"id":21524880,"url":"https://github.com/degjs/formvalidation-email","last_synced_at":"2025-07-27T00:13:39.946Z","repository":{"id":14366260,"uuid":"76422948","full_name":"DEGJS/formValidation-email","owner":"DEGJS","description":"An email rule for the DEGJS formValidation module.","archived":false,"fork":false,"pushed_at":"2023-01-05T23:35:08.000Z","size":537,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-03T14:07:42.999Z","etag":null,"topics":["forms"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DEGJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-14T03:53:23.000Z","updated_at":"2021-01-25T21:24:53.000Z","dependencies_parsed_at":"2023-01-13T17:54:39.673Z","dependency_job_id":null,"html_url":"https://github.com/DEGJS/formValidation-email","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/DEGJS/formValidation-email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformValidation-email","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformValidation-email/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformValidation-email/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformValidation-email/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DEGJS","download_url":"https://codeload.github.com/DEGJS/formValidation-email/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DEGJS%2FformValidation-email/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267273938,"owners_count":24062665,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["forms"],"created_at":"2024-11-24T01:30:18.117Z","updated_at":"2025-07-27T00:13:39.895Z","avatar_url":"https://github.com/DEGJS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# formValidation-email\n![Run Tests](https://github.com/DEGJS/formValidation-email/workflows/Run%20Tests/badge.svg)\n\nAn email rule module for the DEGJS [formValidation](https://github.com/DEGJS/formValidation) module.\n\n\n## Install\nformValidation-email is an ES6 module. Consequently, you'll need an ES6 transpiler ([Babel](https://babeljs.io) is a nice one) as part of your Javascript workflow.\n\nIf you're already using NPM for your project, you can install formValidation-email with the following command:\n\n```\n$ npm install @degjs/form-validation-email\n```\n\n\n## Usage\nAfter importing, formValidation rule modules can be instantiated by passing an array of names into a formValidation options object:\n\n```js\nimport formValidation from \"@degjs/form-validation\";\n\n/* Import the Pattern rule module */\nimport email from \"@degjs/form-validation-email\";\n\nconst validationOptions = {\n    rules: [\n        email\n    ]\n};\n\n/* Instantiate the formValidation module on an element */\nconst formElement = document.querySelector('.form');\nconst validationInst = formValidation(formElement, validationOptions);\n```\n\nOptionally, default rule settings can be overridden by instantiating the rule as a function and passing options as an object: \n```js\nconst validationOptions = {\n    rules: [\n        email({\n            message: 'This message will override the default rule message.',\n            events: [\n                'focusout',\n                'submit'\n            ]\n        })\n    ]\n};\n```\n\nformValidation-email builds upon the HTML5 `email` validation pattern. Therefore, after instantiating the rule module, a field in the validation instance will be tested by this rule simply by setting the field input's type attribute to `email`.\n\nThis rule module contains its own default validation message. However, this message can be overridden by adding a data attribute at the field or form level (in that order of importance).\n\nSample Markup:\n```html\n\u003cform class=\"form\" data-validation-email-message=\"This message will override the default rule message.\"\u003e\n    \u003cfieldset\u003e\n        \u003cdiv class=\"js-validation-field\" data-validation-email-message=\"This message will override both the default rule message and the form element message.\"\u003e\n            \u003clabel for=\"email\"\u003eEmail\u003c/label\u003e\n            \u003cinput type=\"email\" id=\"email\" name=\"email\"\u003e\n        \u003c/div\u003e\n        \u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n    \u003c/fieldset\u003e\n\u003c/form\u003e\n```\n\n\n## Options\n\n#### options.message\nType: `String`  \nDefault: `Please enter a valid email address.`  \nThe default message displayed when a field fails this rule's validation test.\n\n#### options.messageAttr\nType: `String`  \nDefault: `data-validation-pattern-message`  \nThe data attribute formValidation will check when determining [message hierarchy](https://github.com/DEGJS/formValidation#configuring-error-messages)\n\n#### options.events\nType: `Array`  \nDefault: `['focusout','submit']`  \nAn array of DOM events that will cause the rule to run validation on a field (or the entire form, when using `submit`). NOTE: `focusout` should be used in place of `blur` due to event bubbling limitations.\n\n#### options.pattern\nType: `RegEx literal`  \nDefault: ``/^[a-zA-Z0-9.!#$%\u0026'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$``  \nThe RegEx pattern the rule will use to determine a valid email address.\n\nFor more detailed usage instructions, see the [formValidation Usage](https://github.com/DEGJS/formValidation#usage) documentation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fformvalidation-email","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegjs%2Fformvalidation-email","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegjs%2Fformvalidation-email/lists"}