{"id":16271871,"url":"https://github.com/ozgrozer/rfv","last_synced_at":"2025-09-06T12:32:23.134Z","repository":{"id":54739034,"uuid":"162621033","full_name":"ozgrozer/rfv","owner":"ozgrozer","description":"React form validator","archived":false,"fork":false,"pushed_at":"2022-04-01T18:54:07.000Z","size":502,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-26T03:03:55.577Z","etag":null,"topics":["form-validation","form-validator","react","react-form-validation","react-form-validator"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/o572300y0y","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/ozgrozer.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":"2018-12-20T19:07:11.000Z","updated_at":"2024-06-14T07:47:51.000Z","dependencies_parsed_at":"2022-08-14T01:20:26.871Z","dependency_job_id":null,"html_url":"https://github.com/ozgrozer/rfv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ozgrozer/rfv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgrozer%2Frfv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgrozer%2Frfv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgrozer%2Frfv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgrozer%2Frfv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ozgrozer","download_url":"https://codeload.github.com/ozgrozer/rfv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ozgrozer%2Frfv/sbom","scorecard":{"id":716285,"data":{"date":"2025-08-18","repo":{"name":"github.com/ozgrozer/rfv","commit":"64309b2a9cc3fc7f7a5c7c064e64bf43e8ded7f4"},"scorecard":{"version":"v5.2.1-41-g40576783","commit":"40576783fda6698350fcbbeaea760ff827433034"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-xq7p-g2vc-g82p","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-7hpj-7hhx-2fgx","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/40576783fda6698350fcbbeaea760ff827433034/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T09:46:09.523Z","repository_id":54739034,"created_at":"2025-08-22T09:46:09.523Z","updated_at":"2025-08-22T09:46:09.523Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273905008,"owners_count":25188667,"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-09-06T02:00:13.247Z","response_time":2576,"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":["form-validation","form-validator","react","react-form-validation","react-form-validator"],"created_at":"2024-10-10T18:15:03.442Z","updated_at":"2025-09-06T12:32:22.803Z","avatar_url":"https://github.com/ozgrozer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RFV (React Form Validator)\n\n[![npm](https://img.shields.io/npm/v/rfv.svg?style=flat-square)](https://www.npmjs.com/package/rfv)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/ozgrozer/rfv/blob/master/license)\n\nReact form validator and form handler.\n\nRFV uses [Validator.js](https://github.com/chriso/validator.js) as a validator engine, and [Axios](https://github.com/axios/axios) for HTTP requests.\n\n[Demo (Only form validator option)](https://codesandbox.io/s/5wq8o1nqzl)\n\n[Demo (Form validator and form handler option)](https://codesandbox.io/s/o572300y0y)\n\n![](https://media.giphy.com/media/MRGE7BQVc0SlM6ieL4/giphy.gif)\n\n## Installation\n\nInstall with Yarn.\n\n```sh\n$ yarn add rfv\n```\n\nInstall with NPM.\n\n```sh\n$ npm i rfv\n```\n\n## Usage\n\nOnly form validator option.\n\n```jsx\nimport React from 'react'\nimport ReactDOM from 'react-dom'\n\n// Import package\nimport { Form, Input, Textarea } from 'rfv'\n\n// Create validation rules (https://github.com/chriso/validator.js#validators)\nconst validations = {\n  email: [\n    {\n      rule: 'isEmail',\n      invalidFeedback: 'Please provide a valid email'\n    }\n  ],\n  message: [\n    {\n      rule: 'isLength',\n      args: { min: 1 },\n      invalidFeedback: 'Please provide a message'\n    }\n  ]\n}\n\nconst App = () =\u003e {\n  // Learn the status of validation with `res.isFormValid` and get your form data as an object with `res.items` to make an AJAX request or something else\n  const onSubmit = res =\u003e {\n    if (res.isFormValid) {\n      post('url', res.items)\n    }\n  }\n\n  return (\n    // Build your form\n    \u003cForm onSubmit={onSubmit}\u003e\n      \u003cdiv\u003e\n        \u003cInput\n          type='email'\n          name='email'\n          validations={validations.email}\n        /\u003e\n      \u003c/div\u003e\n\n      \u003cdiv\u003e\n        \u003cTextarea\n          name='message'\n          validations={validations.message}\n        /\u003e\n      \u003c/div\u003e\n\n      \u003cdiv\u003e\n        \u003cbutton\u003eSubmit\u003c/button\u003e\n      \u003c/div\u003e\n    \u003c/Form\u003e\n  )\n}\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'))\n```\n\nForm validator and form handler option.\n\n```jsx\nimport React from 'react'\nimport ReactDOM from 'react-dom'\n\n// Import package\nimport { Form, Input, Textarea } from 'rfv'\n\n// Create validation rules (https://github.com/chriso/validator.js#validators)\nconst validations = {\n  email: [\n    {\n      rule: 'isEmail',\n      invalidFeedback: 'Please provide a valid email'\n    }\n  ],\n  message: [\n    {\n      rule: 'isLength',\n      args: { min: 1 },\n      invalidFeedback: 'Please provide a message'\n    }\n  ]\n}\n\nconst App = () =\u003e {\n  // After an AJAX call, call the `res.data` to get the backend results\n  const postSubmit = res =\u003e {\n    console.log(res.data)\n  }\n\n  return (\n    // Build your form\n    \u003cForm\n      postSubmit={postSubmit}\n      postOptions={{ method: 'post', url: 'url' }}\n    \u003e\n      \u003cdiv\u003e\n        \u003cInput\n          type='email'\n          name='email'\n          validations={validations.email}\n        /\u003e\n      \u003c/div\u003e\n\n      \u003cdiv\u003e\n        \u003cTextarea\n          name='message'\n          validations={validations.message}\n        /\u003e\n      \u003c/div\u003e\n\n      \u003cdiv\u003e\n        \u003cbutton\u003eSubmit\u003c/button\u003e\n      \u003c/div\u003e\n    \u003c/Form\u003e\n  )\n}\n\nReactDOM.render(\u003cApp /\u003e, document.getElementById('root'))\n```\n\nAnd add `.is-invalid` and `.invalid-feedback` classes into your CSS.\n\n```css\n.is-invalid {\n  border: 1px solid #dc3545;\n}\n\n.invalid-feedback {\n  display: none;\n  color: #dc3545;\n}\n\n.is-invalid ~ .invalid-feedback {\n  display: block;\n}\n```\n\nMake sure you add the errors to the `validations` object in backend.\n\n```js\napp.post('/sign-up', (req, res) =\u003e {\n  const result = {\n    validations: {}\n  }\n\n  if (req.body.username === 'john') {\n    result.validations.username = 'john is already registered'\n  }\n\n  res.send(result)\n})\n```\n\n## Props \u0026 Callbacks\n\n`\u003cForm\u003e`\n\nProps\n\n```jsx\n// Since RFV uses Axios for HTTP requests, whatever you pass into postOptions prop except `data: {}`, directly goes into Axios\n\u003cForm\n  runValidation={true|false}\n  postOptions={{\n    url: 'url',\n    method: 'post',\n    headers: {\n      'Authorization': 'Token ...'\n    }\n  }}\n\u003e\n```\n\nCallbacks\n\n```jsx\n\u003cForm\n  removeItems={['key1', 'key2']}\n  preSubmit={res =\u003e {\n    // res.e\n    // res.items\n    // res.setItems({})\n  }}\n  onSubmit={res =\u003e {\n    // res.e\n    // res.items\n    // res.isFormValid\n    // res.setItems({})\n  }}\n  postSubmit={res =\u003e {\n    // res.e\n    // res.data\n    // res.error\n    // res.items\n    // res.isFormValid\n    // res.setItems({})\n    // res.isPostSubmitFormValid\n  }}\n\u003e\n```\n\n`\u003cInput\u003e`, `\u003cSelect\u003e`, `\u003cTextarea\u003e`\n\nProps\n\n```jsx\n// You can pass more than one validation\n\u003cInput\n  validations={[\n    {\n      rule: 'isLength',\n      args: { min: 1 },\n      invalidFeedback: 'Please provide a username'\n    },\n    {\n      rule: 'isLength',\n      args: { min: 4, max: 32 },\n      invalidFeedback: 'Username must be minimum 4, maximum 32 characters'\n    }\n  ]}\n/\u003e\n```\n\nCallbacks\n\n```jsx\n\u003cInput\n  onChange={res =\u003e {\n    // res.e\n    // res.validated\n  }}\n/\u003e\n```\n\n## Contribution\n\nFeel free to contribute. Open a new [issue](https://github.com/ozgrozer/rfv/issues), or make a [pull request](https://github.com/ozgrozer/rfv/pulls).\n\n## License\n\n[MIT](https://github.com/ozgrozer/rfv/blob/master/license)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgrozer%2Frfv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozgrozer%2Frfv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozgrozer%2Frfv/lists"}