{"id":20712066,"url":"https://github.com/dhaval2404/android-form-validation","last_synced_at":"2025-06-10T17:33:01.465Z","repository":{"id":45800667,"uuid":"250441752","full_name":"Dhaval2404/android-form-validation","owner":"Dhaval2404","description":"UI form validation library for Android ✔","archived":false,"fork":false,"pushed_at":"2020-12-23T11:34:20.000Z","size":695,"stargazers_count":61,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T06:59:56.558Z","etag":null,"topics":["androi","form-validation","kotlin","validation"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dhaval2404.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":"2020-03-27T04:40:47.000Z","updated_at":"2024-09-19T04:23:32.000Z","dependencies_parsed_at":"2022-07-17T01:46:32.042Z","dependency_job_id":null,"html_url":"https://github.com/Dhaval2404/android-form-validation","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dhaval2404%2Fandroid-form-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dhaval2404%2Fandroid-form-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dhaval2404%2Fandroid-form-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dhaval2404%2Fandroid-form-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dhaval2404","download_url":"https://codeload.github.com/Dhaval2404/android-form-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250386746,"owners_count":21422026,"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":["androi","form-validation","kotlin","validation"],"created_at":"2024-11-17T02:18:03.367Z","updated_at":"2025-04-23T07:00:07.020Z","avatar_url":"https://github.com/Dhaval2404.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✔UI form validation library for Android\n\n[![Download](https://api.bintray.com/packages/dhaval2404/maven/android-form-validation/images/download.svg) ](https://bintray.com/dhaval2404/maven/android-form-validation/_latestVersion)\n[![Releases](https://img.shields.io/github/release/dhaval2404/android-form-validation/all.svg?style=flat-square)](https://github.com/Dhaval2404/android-form-validation/releases)\n[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19)\n![Language](https://img.shields.io/badge/language-Kotlin-orange.svg)\n[![PRWelcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Dhaval2404/android-form-validation)\n[![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/)\n![License](https://img.shields.io/github/license/Dhaval2404/android-form-validation.svg)\n![Build Status](https://github.com/Dhaval2404/android-form-validation/workflows/build%20debug/badge.svg)\n[![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-ImagePicker-green.svg?style=flat)]( https://android-arsenal.com/details/1/8098)\n[![Twitter](https://img.shields.io/twitter/url/https/github.com/Dhaval2404/android-form-validation.svg?style=social)](https://twitter.com/intent/tweet?text=Checkout%20the%20UI%20form%20validation%20library%20for%20Android.%20https%3A%2F%2Fgithub.com%2FDhaval2404%2Fandroid-form-validation)\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003eBuilt with ❤︎ by\n  \u003ca href=\"https://twitter.com/Dhaval2404\"\u003eDhaval Patel\u003c/a\u003e and\n  \u003ca href=\"https://github.com/dhaval2404/android-form-validation/graphs/contributors\"\u003e\n    contributors\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\nYet another UI form validation library for Android. It is highly customizable and easy to use. This library will works with **TextView**, **EditText**, **AppCompatEditText**, **TextInputEditText**, **TextInputLayout** and **CheckBox**. This library is designed in such a way that Its easy to add support for new widgets and add new rules.\n\n# 💻Usage\n\n\n1. Gradle dependency:\n\n\t```groovy\n\timplementation 'com.github.dhaval2404:android-form-validation:1.0'\n\t```\n\n2. The **android-form-validation** configuration is created using the builder pattern.\n\n\t```kotlin\n    private fun isValidForm(): Boolean {\n        return FormValidator.getInstance()\n            .addField(firstNameEt, NonEmptyRule(R.string.error_empty_first_name))\n            .addField(lastNameEt, NonEmptyRule(R.string.error_empty_last_name))\n            .addField(\n                emailEtLyt,\n                NonEmptyRule(\"Please enter Email\"),\n                EmailRule(R.string.error_invalid_email)\n            )\n            .addField(\n                passwordEtLyt,\n                NonEmptyRule(\"Please enter Password\"),\n                PasswordRule(\"Please provide strong Password\")\n            )\n            .addField(\n                confirmPasswordEtLyt,\n                NonEmptyRule(\"Please enter Password\"),\n                EqualRule(\n                    confirmPasswordEt.text.toString(),\n                    \"Password and Confirm password must match\"\n                )\n            )\n            .addField(\n                phoneNumberEt,\n                NonEmptyRule(\"Please enter Phone Number\"),\n                LengthRule(10, \"Please enter valid Phone Number\")\n            )\n            .addField(\n                termsOfUseCB,\n                CheckedRule(\"Accept terms of use\")\n            )\n            .setErrorListener {\n                // Require only for CheckBox with Toast or Custom View Only\n                for (error in it) {\n                    if (error.view is CheckBox) {\n                        (error.view as CheckBox).error = null\n                        Toast.makeText(applicationContext, error.error, Toast.LENGTH_SHORT).show()\n                    }\n                    Log.e(\"Error\", error.toString())\n                }\n            }\n            .validate()\n    }\n    ```\n\n# 📐Supported Rules:\n\n* CheckedRule(Used with CheckBox only)\n\n  ```kotlin\n  addField(termsOfUseCheckbox, CheckedRule(\"Accept terms of use\"))\n  ```\n\n* EmailRule\n\n  ```kotlin\n  addField(emailEditText, EmailRule(\"Please enter valid Email\"))\n  ```\n\n* EqualRule\n \t```kotlin\n  // Combile 2 rules for Confirm Password Validation\n  // Check if Password is valid and Password match with Confirm Password\n  addField(confirmPasswordEditText,\n  \t\tPasswordRule(PasswordPattern.ALPHA_NUMERIC, \"Please provide strong Password\"),\n  \t\tEqualRule(passwordEditText.text.toString(), \"Password not matching\")\n  )\n  ```\n\n \t```kotlin\n  // Combile 2 rules for Confirm Email Validation\n  // Check if Email is valid and Email match with Confirm Email\n  addField(emailEditText,\n  \t\tEmailRule(\"Please enter valid Email\"),\n  \t\tEqualRule(confirmEmailEditText.text.toString(), \"Email not matching\")\n  )\n  ```\n\n* LengthRule\n\n  ```kotlin\n  addField(phoneNumberEditText, LengthRule(10, \"Please enter valid Phone Number\"))\n  ```\n\n* MaxLengthRule\n\n  ```kotlin\n  addField(messageEditText, MaxLengthRule(50, \"Message should be less than 50 character long\"))\n  ```\n\n* MinLengthRule\n\n  ```kotlin\n  addField(messageEditText, MinLengthRule(10, \"Please enter message with at least 10 character\"))\n  ```\n\n  ```kotlin\n  // Check if Phone Number Length is between 10-13\n  addField(phoneNumberEditText,\n\t\tMinLengthRule(10, \"Please enter valid Phone Number\"),\n\t\tMaxLengthRule(13, \"Please enter valid Phone Number\"))\n  ```\n\n* NumberRule\n\n  ```kotlin\n  addField(priceEditText, NumberRule(\"Please enter valid Price\"))\n  ```\n\n* NonEmptyRule\n\n  ```kotlin\n  addField(firstNameEditText, NonEmptyRule(\"Please enter First Name\"))\n  ```\n\n* PasswordRule\n\n  ```kotlin\n  // Password can have any characters\n  addField(passwordEditText, PasswordRule(\"Please enter Password\"))\n  ```\n\n  ```kotlin\n  // Password should have alphabets and numeric character both\n  addField(passwordEditText, PasswordRule(PasswordPattern.ALPHA_NUMERIC, \"Please provide strong Password\"))\n  ```\n\n* RegexRule\n\n  ```kotlin\n  addField(usernameEditText, RegexRule(RegexRule.USERNAME_PATTERN, \"Please enter valid Username\"))\n  ```\n\n  ```kotlin\n  addField(usernameEditText, RegexRule(\"^[a-zA-Z0-9_-]{3,16}\",  \"Please enter valid Username\"))\n  ```\n\n\n\n# 💥Compatibility\n\n  * Library - Android Kitkat 4.4+ (API 19)\n  * Sample - Android Kitkat 4.4+ (API 19)\n\n# ✔️Changelog\n\n### Version: 1.0\n\n  * Initial Build\n\n### Let us know!\n\nWe'll be really happy if you sent us links to your projects where you use our library. Just send an email to **dhavalpatel244@gmail.com** And do let us know if you have any questions or suggestion regarding the library.\n\n## License\n\n    Copyright 2020, Dhaval Patel\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n         http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhaval2404%2Fandroid-form-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhaval2404%2Fandroid-form-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhaval2404%2Fandroid-form-validation/lists"}