{"id":21083203,"url":"https://github.com/zhoukekestar/input-validator","last_synced_at":"2026-04-24T18:07:40.427Z","repository":{"id":83127571,"uuid":"91330729","full_name":"zhoukekestar/input-validator","owner":"zhoukekestar","description":"Validator for input control.","archived":false,"fork":false,"pushed_at":"2017-08-31T07:16:18.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-29T21:26:16.063Z","etag":null,"topics":["ajax","form","input","validation","validator"],"latest_commit_sha":null,"homepage":null,"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/zhoukekestar.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-15T11:36:12.000Z","updated_at":"2017-05-15T14:04:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"8809b71a-d4a0-412b-b48e-0cadfd5f5b9f","html_url":"https://github.com/zhoukekestar/input-validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zhoukekestar/input-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhoukekestar%2Finput-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhoukekestar%2Finput-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhoukekestar%2Finput-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhoukekestar%2Finput-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhoukekestar","download_url":"https://codeload.github.com/zhoukekestar/input-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhoukekestar%2Finput-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32234824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ajax","form","input","validation","validator"],"created_at":"2024-11-19T20:16:55.338Z","updated_at":"2026-04-24T18:07:40.386Z","avatar_url":"https://github.com/zhoukekestar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# input-validator\nLightweight validator for input control.\n\nIf you only use `core.js`. You will see different notification on different browser.\n\n| Chrome | Firefox | IE |\n| --- | --- | --- |\n| ![chrome](./assets/noti/chrome.png) | ![firefox](./assets/noti/firefox.png) | ![ie](./assets/noti/ie.png) |\n\nTest this [core feature online](https://zhoukekestar.github.io/input-validator/test/core.html).\n\n# Features\n* `setDefaultMessages` to set messages for `patternMismatch`, `valueMissing` and so on. [Try this online.](https://zhoukekestar.github.io/input-validator/test/core-default-messages.html)\n\n  ```js\n  HTMLInputValidatorElement.setDefaultMessages({\n    valueMissing: 'Sorry, you have to input this. by default message~'\n  })\n  ```\n\n* `registerType` to register your custom type.  [Try this online.](https://zhoukekestar.github.io/input-validator/test/core-register-type.html)\n\n  ```html\n  \u003cform\u003e\n    \u003cinput type='OneORZero'\u003e\n  \u003c/form\u003e\n  \u003cscript\u003e\n    HTMLInputValidatorElement.registerType('OneORZero', function (value) {\n      if (value === '0' || value === '1') return '';\n      return 'Please input 0 or 1.';\n    });\n  \u003c/script\u003e\n  ```\n\n* `title` Set title to show custom message. [Try this online.](https://zhoukekestar.github.io/input-validator/test/core-title.html)\n\n  ```html\n  \u003cform\u003e\n    \u003cinput name=\"key\" required title='This field is required! by title~'\u003e\n  \u003c/form\u003e\n  ```\n\n\n\n# Events\nThis is an enhancement feature (not W3C). Because native `invalid` event can't bubbles to parents.\n* `input-valid` if an input set a valid value.\n* `input-invalid` if an input set a invalid value.\n\n# Submit\nThis is an enhancement feature (not W3C).\n\nBrowser won't check validity if you call native submit by js. We hook the native\nsubmit to check validity. So you can submit form by `input`, `button` or `submit()`.\n\n```html\n\u003cform\u003e\n  \u003cinput name='key'\u003e\n  \u003cinput type='submit'\u003e\n  \u003cbutton\u003ebutton\u003c/button\u003e\n  \u003ca href=\"javascript:;\" onclick='this.parentNode.submit()'\u003esubmit()\u003c/a\u003e\n\u003c/form\u003e\n```\n\n# Browser Compatibility\n* `checkValidity` [IE 10+](http://caniuse.com/#search=checkValidity)\n\n# Third Party\n* `form-json` This library works well with form-json. [Try this online.](https://zhoukekestar.github.io/input-validator/test/work-with-form-json.html)\n  ```html\n  \u003cform enctype=\"application/form-json\"\u003e\n    \u003cinput name='name' required title='you have to input this field ~'\u003e\n    \u003cinput type='submit' /\u003e\n  \u003c/form\u003e\n  ```\n\n# Read More\n* [constraintvalidation on html5rocks](https://www.html5rocks.com/en/tutorials/forms/constraintvalidation/)\n* [Form_validation on MDN](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhoukekestar%2Finput-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhoukekestar%2Finput-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhoukekestar%2Finput-validator/lists"}