{"id":13445688,"url":"https://github.com/SinanBozkus/FormHelper","last_synced_at":"2025-03-21T05:31:02.299Z","repository":{"id":38032627,"uuid":"184936698","full_name":"sinanbozkus/FormHelper","owner":"sinanbozkus","description":"ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)","archived":false,"fork":false,"pushed_at":"2022-11-29T12:49:52.000Z","size":299,"stargazers_count":270,"open_issues_count":8,"forks_count":35,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-11-09T03:53:24.202Z","etag":null,"topics":["asp-net-core","aspnet-core","aspnet-core-mvc","aspnet-core-validator","aspnet-mvc","aspnetcore","dotnet","fluent-validation","fluent-validation-client-side","fluentvalidation","fluentvalidation-clientside","form","form-validation","form-validator","formhelper","javascript","netcore","validation","validator"],"latest_commit_sha":null,"homepage":"","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/sinanbozkus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-04T19:33:27.000Z","updated_at":"2024-11-03T13:04:37.000Z","dependencies_parsed_at":"2023-01-21T22:03:59.882Z","dependency_job_id":null,"html_url":"https://github.com/sinanbozkus/FormHelper","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbozkus%2FFormHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbozkus%2FFormHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbozkus%2FFormHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinanbozkus%2FFormHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinanbozkus","download_url":"https://codeload.github.com/sinanbozkus/FormHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244745683,"owners_count":20503044,"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":["asp-net-core","aspnet-core","aspnet-core-mvc","aspnet-core-validator","aspnet-mvc","aspnetcore","dotnet","fluent-validation","fluent-validation-client-side","fluentvalidation","fluentvalidation-clientside","form","form-validation","form-validator","formhelper","javascript","netcore","validation","validator"],"created_at":"2024-07-31T05:00:37.907Z","updated_at":"2025-03-21T05:31:01.999Z","avatar_url":"https://github.com/sinanbozkus.png","language":"JavaScript","readme":"# Form Helper\n\n### \\#1 Form Library for ASP.NET Core MVC\n\nIf you like this library and want to support it, please give a star. :star:\t\n\nForm \u0026amp; Validation Helper for **ASP.NET Core MVC**\n\nForm Helper helps you to create ajax forms and validations without writing any javascript code. **It transforms server-side validations to client-side.** You can also use the form validator without ajax.\n\n### **Compatible with Fluent Validation** :white_check_mark:\t\n(You can add client-side validation support to Fluent Validation.)\n\n[![NuGet](https://img.shields.io/nuget/v/FormHelper.svg)](https://nuget.org/packages/FormHelper) [![Nuget](https://img.shields.io/nuget/dt/FormHelper.svg)](https://nuget.org/packages/FormHelper)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"http://www.sinanbozkus.com/nuget/formhelper/formhelper-screenshot.png\" alt=\"FormHelper\" /\u003e\n\u003c/p\u003e\n\n## Installation\n\nFormHelper can be installed using the *Nuget Package Manager* or the *dotnet CLI*.\n\nPackage Manager:\n```\nInstall-Package FormHelper\n```\n\ndotnet CLI:\n```csharp\ndotnet add package FormHelper\n```\n\nThis library works with [jQuery](https://jquery.com)\n\nCDN:\n```html\n\u003c!-- form helper - You don't need to add these files to your project, just add it. it's embeded! --\u003e\n\u003c!-- if you dont't want to use these embeded files, you can download the files from dist folder --\u003e\n\u003c!-- You can use formhelper.js/css instead of formhelper.min.js/css to debug. --\u003e\n\u003c!-- The bundle file includes jQuery validation and jQuery validation unobtrusive --\u003e\n\n\u003clink rel=\"stylesheet\" href=\"/formhelper/formhelper.min.css\" /\u003e\n\u003cscript src=\"/formhelper/formhelper.bundle.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\n**Startup.cs**\n\nConfigureServices:\n```\nservices.AddControllersWithViews().AddFormHelper();\n```\n*With configuration: (optional)*\n```\nservices.AddControllersWithViews().AddFormHelper(options =\u003e {\n    options.CheckTheFormFieldsMessage = \"Your custom message...\";\n    options.RedirectDelay = 6000;\n    options.EmbeddedFiles = true;\n    options.ToastrDefaultPosition = ToastrPosition.TopFullWidth;\n});\n```\nConfigure:\n```\n\u003c!-- If you want to use embeded form helper files, add this line --\u003e\napp.UseFormHelper();\n```\n\n**ViewImports.cshtml**\n```csharp\n@using FormHelper\n@addTagHelper *, FormHelper\n```\n\n\n**View: (TagHelper)**\n```csharp\n\u003cform asp-formhelper=\"true\" asp-controller=\"Home\" asp-action=\"Save\"\u003e\n   // \u003cinput...\n   // ...\n\u003c/form\u003e\n\n// You can use \u003cform asp-formhelper=\"true\"\u003e or \u003cformhelper\u003e to activate formhelper.\n// Optional parameters:\n// asp-callback=\"javascriptFunctionName\", asp-beforeSubmit=\"javascriptFunctionName\", asp-dataType=\"FormData/Json\", asp-enableButtonAfterSuccess=\"false\", asp-resetFormAfterSuccess=\"true\" asp-toastrPosition=\"ToastrPosition.BottomRight\"\n```\n\n**Controller:**\n```csharp\n[FormValidator]\npublic IActionResult Save(FormViewModel viewModel)\n\n// If you use Json data type, you need to add [FromBody] attribute.\n// public IActionResult Save([FromBody]FormViewModel viewModel)\n```\n\n**Return a result from Controller:**\n\nError Message:\n```\nreturn FormResult.CreateErrorResult(\"An error occured.\");\n```\nSuccess Message:\n```\nreturn FormResult.CreateSuccessResult(\"Product saved.\");\n```\nSuccess Message with Redirect:\n```\nreturn FormResult.CreateSuccessResult(\"Product saved. Please wait...\", Url.Action(\"Home\", \"Index\"));\n```\nSuccess Message with Redirect and Delay Time:\n```\nreturn FormResult.CreateSuccessResult(\"Product saved. Please wait...\", Url.Action(\"Home\", \"Index\"), 10000); // 10 seconds\n```\n\n**Fill the form fields from a json object:**\n```\n$(\"#formId\").fillFormFields(yourJsonObject);\n```\n\n**Reset form and clear error messages:**\n```\n$(\"#formId\").fhReset();\n```\n\n**Toastr:**\n\nSuccess:\n```\nfhToastr.success(\"Text here\");\n```\nWarning:\n```\nfhToastr.warning(\"Text here\");\n```\nInformation:\n```\nfhToastr.information(\"Text here\");\n```\nError:\n```\nfhToastr.error(\"Text here\");\n```\n","funding_links":[],"categories":["Frameworks, Libraries and Tools","框架, 库和工具","Misc","杂项"],"sub_categories":["Misc","大杂烩"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSinanBozkus%2FFormHelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSinanBozkus%2FFormHelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSinanBozkus%2FFormHelper/lists"}