{"id":31584230,"url":"https://github.com/vertyll/form-builder","last_synced_at":"2026-04-11T14:16:07.968Z","repository":{"id":258696718,"uuid":"875354800","full_name":"vertyll/form-builder","owner":"vertyll","description":"A library for building forms with various fields and validation for Rust ecosystem.","archived":false,"fork":false,"pushed_at":"2025-03-31T20:33:31.000Z","size":71,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-13T04:40:39.940Z","etag":null,"topics":["rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/form_builder","language":"Rust","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/vertyll.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":"2024-10-19T18:47:28.000Z","updated_at":"2025-12-02T19:21:25.000Z","dependencies_parsed_at":"2024-11-17T09:26:17.672Z","dependency_job_id":"969067fa-8e09-4cef-8ebc-0e1afd33f4a0","html_url":"https://github.com/vertyll/form-builder","commit_stats":null,"previous_names":["vertyll/form-builder"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vertyll/form-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertyll%2Fform-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertyll%2Fform-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertyll%2Fform-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertyll%2Fform-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vertyll","download_url":"https://codeload.github.com/vertyll/form-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vertyll%2Fform-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31683479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["rust"],"created_at":"2025-10-06T00:46:42.501Z","updated_at":"2026-04-11T14:16:07.961Z","avatar_url":"https://github.com/vertyll.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# form_builder\n\nA library for building forms with various fields and validation.\n\n## Overview\n\n`form_builder` is a Rust library designed to simplify the creation and validation of forms. It provides a flexible way to define forms with different types of fields, including text fields, select fields, and multiselect fields. The library also supports custom validation for these fields, making it easy to ensure that user input meets specific criteria.\n\n## Features\n\n- **Flexible Form Creation**: Easily create forms with various types of fields.\n- **Custom Validation**: Define custom validation rules for each field.\n- **Optional Fields**: Support for optional fields using the `Optional` type.\n- **Select and Multiselect Fields**: Built-in support for select and multiselect fields.\n- **Comprehensive Error Handling**: Detailed error messages for validation failures.\n\n## Installation\n\nTo use `form_builder` in your project, add the following to your `Cargo.toml`:\n\n```toml\n[dependencies]\nform_builder = \"LATEST_VERSION\"\n```\n\n## Example\n\n```rust\nuse form_builder::{FormBuilder, Optional, ValidationMethods, Validator};\n\nfn validate_custom(value: \u0026str) -\u003e bool {\n    value.len() \u003e 5\n}\n\nfn main() -\u003e Result\u003c(), String\u003e {\n    let mut form = FormBuilder::new()\n        .add_field::\u003cString\u003e(\n            \"name\",\n            \"Enter name:\",\n            Some(Validator::new(vec![\n                (ValidationMethods::not_empty, Some(\"Name cannot be empty\")),\n                (\n                    ValidationMethods::validate_name,\n                    Some(\"Name cannot contain numbers\"),\n                ),\n            ])),\n        )\n        .add_field::\u003cString\u003e(\n            \"email\",\n            \"Enter email:\",\n            Some(Validator::new(vec![\n                (ValidationMethods::not_empty, Some(\"Email cannot be empty\")),\n                (\n                    ValidationMethods::validate_email,\n                    Some(\"Invalid email format\"),\n                ),\n            ])),\n        )\n        .add_field::\u003cu32\u003e(\n            \"age\",\n            \"Enter age:\",\n            Some(Validator::new(vec![(\n                ValidationMethods::not_empty,\n                Some(\"Age cannot be empty\"),\n            )])),\n        )\n        .add_field::\u003cString\u003e(\n            \"custom\",\n            \"Enter custom value:\",\n            Some(Validator::new(vec![\n                (\n                    ValidationMethods::not_empty,\n                    Some(\"Custom value cannot be empty\"),\n                ),\n                (\n                    validate_custom,\n                    Some(\"Custom value must be longer than 5 characters\"),\n                ),\n            ])),\n        )\n        .add_field::\u003cf64\u003e(\n            \"height\",\n            \"Enter height:\",\n            Some(Validator::new(vec![(\n                ValidationMethods::not_empty,\n                Some(\"Height cannot be empty\"),\n            )])),\n        )\n        .add_field::\u003cbool\u003e(\n            \"is_student\",\n            \"Are you a student (true/false):\",\n            Some(Validator::new(vec![(\n                ValidationMethods::not_empty,\n                Some(\"This field cannot be empty\"),\n            )])),\n        )\n        .add_field::\u003cchar\u003e(\n            \"initial\",\n            \"Enter your initial:\",\n            Some(Validator::new(vec![(\n                ValidationMethods::not_empty,\n                Some(\"Initial cannot be empty\"),\n            )])),\n        )\n        .add_field::\u003cOptional\u003cu32\u003e\u003e(\"width\", \"Enter width (optional):\", None)\n        .add_select(\n            \"gender\",\n            \"Select your gender:\",\n            vec![\n                (1u32, \"Male\"),\n                (2u32, \"Female\"),\n                (3u32, \"Other\"),\n            ],\n        )\n        .add_multiselect(\n            \"hobbies\",\n            \"Select your hobbies:\",\n            vec![\n                (\"reading\".to_string(), \"Reading\"),\n                (\"sports\".to_string(), \"Sports\"),\n                (\"music\".to_string(), \"Music\"),\n            ],\n            Some(2),\n        )\n        .build();\n\n    form.fill()?;\n\n    let name: String = form.get_value(\"name\")?;\n    let email: String = form.get_value(\"email\")?;\n    let age: u32 = form.get_value(\"age\")?;\n    let custom: String = form.get_value(\"custom\")?;\n    let height: f64 = form.get_value(\"height\")?;\n    let is_student: bool = form.get_value(\"is_student\")?;\n    let initial: char = form.get_value(\"initial\")?;\n    let width: Optional\u003cu32\u003e = form.get_value(\"width\")?;\n    let gender: u32 = form.get_value(\"gender\")?;\n    let hobbies: Vec\u003cString\u003e = form.get_value_vec(\"hobbies\")?;\n\n    let width = process_width(width);\n\n    println!(\n        \"Name: {:?}, Email: {:?}, Age: {:?}, Custom: {:?}, Height: {:?}, Is Student: {:?}, Initial: {:?}, Width: {:?}, Gender: {:?}, Hobbies: {:?}\",\n        name, email, age, custom, height, is_student, initial, width, gender, hobbies\n    );\n\n    Ok(())\n}\n\nfn process_width(width: Optional\u003cu32\u003e) -\u003e u32 {\n    match width {\n        Optional::Some(value) =\u003e value + 20,\n        Optional::None =\u003e 0,\n    }\n}\n```\n\n## Documentation\n\nFor more detailed documentation, including all available methods and examples, please refer to the [API documentation](https://docs.rs/form_builder).\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Dependency Licenses\n\nThis project uses the following packages under the MIT license:\n\n- [regex](https://github.com/rust-lang/regex) – MIT License\n- [libc](https://github.com/rust-lang/libc) – MIT License\n\nEach of these packages includes an MIT license file, which can be found in their repositories.\n\n## Contributing\n\nContributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you would like to contribute code, please fork the repository and submit a pull request.\n\n## Acknowledgements\n\nSpecial thanks to the Rust community for their support and contributions to the ecosystem. This library would not be possible without the hard work and dedication of many individuals.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertyll%2Fform-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvertyll%2Fform-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvertyll%2Fform-builder/lists"}