From b323862e034023dce560c59f34fa575d93cd587b Mon Sep 17 00:00:00 2001 From: shaamilahmed Date: Mon, 13 Apr 2026 18:40:17 +0500 Subject: [PATCH] Migrating all validation to use HTMX and endpoints instead of WASM/Websocket connections --- .../Components/App.razor | 3 + .../Components/Pages/FormsDemo.razor | 61 +- .../ContactFormModel.cs | 13 + .../ContactFormValidator.cs | 47 ++ .../Program.cs | 22 +- .../FormsTests.cs | 2 +- .../ValidationTests.cs | 648 ++++++++++++++++++ .../Enciphered.Blazor.UIComponents.csproj | 1 + .../Forms/Button.razor | 9 - .../Forms/DateInput.razor | 4 +- .../Forms/DateTimeInput.razor | 12 +- .../Forms/FormField.razor | 26 +- .../Forms/HtmxForm.razor | 30 + .../Forms/InputBase.cs | 49 +- .../Forms/NumberInput.razor | 2 +- .../Forms/TextInput.razor | 6 +- .../Forms/TimeInput.razor | 9 +- .../Forms/Validation/FormModelBinder.cs | 55 ++ .../Forms/Validation/FormValidationRule.cs | 71 ++ .../Forms/Validation/FormValidator.cs | 55 ++ .../HtmxFormValidationExtensions.cs | 79 +++ .../Validation/HtmxFormValidationRenderer.cs | 62 ++ .../wwwroot/css/app.css | 2 +- .../wwwroot/js/forms.js | 123 ++-- 24 files changed, 1203 insertions(+), 188 deletions(-) create mode 100644 Enciphered.Blazor.UIComponents.Demo/ContactFormModel.cs create mode 100644 Enciphered.Blazor.UIComponents.Demo/ContactFormValidator.cs create mode 100644 Enciphered.Blazor.UIComponents.Tests/ValidationTests.cs create mode 100644 Enciphered.Blazor.UIComponents/Forms/HtmxForm.razor create mode 100644 Enciphered.Blazor.UIComponents/Forms/Validation/FormModelBinder.cs create mode 100644 Enciphered.Blazor.UIComponents/Forms/Validation/FormValidationRule.cs create mode 100644 Enciphered.Blazor.UIComponents/Forms/Validation/FormValidator.cs create mode 100644 Enciphered.Blazor.UIComponents/Forms/Validation/HtmxFormValidationExtensions.cs create mode 100644 Enciphered.Blazor.UIComponents/Forms/Validation/HtmxFormValidationRenderer.cs diff --git a/Enciphered.Blazor.UIComponents.Demo/Components/App.razor b/Enciphered.Blazor.UIComponents.Demo/Components/App.razor index 1bf5326..9d4937b 100644 --- a/Enciphered.Blazor.UIComponents.Demo/Components/App.razor +++ b/Enciphered.Blazor.UIComponents.Demo/Components/App.razor @@ -26,6 +26,9 @@ +