[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DZCFRXG6SN9C5VYNZEE195":3,"skill-same:01M6DZCFRXG6SN9C5VYNZEE195":70},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M6DZCFRXG6SN9C5VYNZEE195","collect-user-input",null,"Build forms, validate data, and react to user input in Blazor. USE FOR adding forms, search boxes, filter panels, inline editing, data-entry UI, file uploads, validation (annotations or custom), handling form submissions, and binding input controls. Covers EditForm, built-in input components, DataAnnotationsValidator, custom validation, SSR form patterns (SupplyParameterFromForm, FormName, AntiforgeryToken, Enhance), and @bind for simple interactive controls. DO NOT USE for project scaffolding (see create-blazor-project) or prerendering issues (see support-prerendering).","managedcode\u002Fdotnet-skills","managedcode","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F78253589?v=4","01M6DYDJR3EG8KB5G4PC65XCTT","Managed Code","01M6DYDJX0ZT432N04NYJW89DN",515,"MIT","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet-blazor\u002Fskills\u002Fcollect-user-input\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"collect user input","input","collect","user","inline","support","project scaffolding","filter","panels","bind","project","scaffolding","forms","data","validate data","search","issues","blazor","create","ssr","react","components","2026-11-10 10:12:30",false,"---\nlicense: MIT\nname: collect-user-input\ndescription: Build forms, validate data, and react to user input in Blazor. USE FOR adding forms, search boxes, filter panels, inline editing, data-entry UI, file uploads, validation (annotations or custom), handling form submissions, and binding input controls. Covers EditForm, built-in input components, DataAnnotationsValidator, custom validation, SSR form patterns (SupplyParameterFromForm, FormName, AntiforgeryToken, Enhance), and @bind for simple interactive controls. DO NOT USE for project scaffolding (see create-blazor-project) or prerendering issues (see support-prerendering).\n---\n\n# Collect User Input\n\n## Step 1 — Read the Project's AGENTS.md\n\nCheck `AGENTS.md` for **Interactivity Mode** and **Interactivity Scope**. This determines which form patterns apply:\n\n| Mode | Form mechanism |\n|------|---------------|\n| None (Static SSR) | `EditForm` with `FormName` + `[SupplyParameterFromForm]`. No `@bind`, no `@onchange`. |\n| Server | `EditForm` with `@bind-Value`. Full interactivity — real-time validation, dynamic UI. |\n| WebAssembly | Same as Server, but validators needing server data must call APIs. |\n| Auto | Same as WebAssembly — code must work in both browser and server. |\n\n| Scope | Impact |\n|-------|--------|\n| Global | All forms are interactive. `FormName` only needed when explicitly opting a page to static SSR. |\n| Per-page | Forms in static pages use `FormName` + `[SupplyParameterFromForm]`. Forms in `@rendermode` pages use `@bind-Value`. |\n\n## EditForm Setup\n\n`EditForm` requires **either** `Model` or `EditContext` — never both.\n\n### Model-based (default)\n\n```razor\n\u003CEditForm Model=\"Employee\" OnValidSubmit=\"HandleSubmit\" FormName=\"employee\">\n    \u003CDataAnnotationsValidator \u002F>\n    \u003CValidationSummary \u002F>\n\n    \u003Clabel>\n        Name: \u003CInputText @bind-Value=\"Employee!.Name\" \u002F>\n        \u003CValidationMessage For=\"() => Employee!.Name\" \u002F>\n    \u003C\u002Flabel>\n\n    \u003Cbutton type=\"submit\">Save\u003C\u002Fbutton>\n\u003C\u002FEditForm>\n\n@code {\n    [SupplyParameterFromForm]\n    private EmployeeModel? Employee { get; set; }\n\n    protected override void OnInitialized() => Employee ??= new();\n\n    private async Task HandleSubmit()\n    {\n        \u002F\u002F Save Employee\n    }\n}\n```\n\nThis single pattern works in **both** SSR and interactive modes:\n- In SSR: `FormName` identifies the form, `[SupplyParameterFromForm]` binds POST data, `??=` initializes on GET.\n- In interactive: `@bind-Value` provides two-way binding, `[SupplyParameterFromForm]` is ignored, `FormName` is harmless.\n\n### EditContext-based (advanced)\n\nUse when you need programmatic field tracking, dynamic validation rules, or manual `EditContext.Validate()` calls:\n\n```csharp\nprivate EditContext? editContext;\nprivate EmployeeModel model = new();\n\nprotected override void OnInitialized()\n{\n    editContext = new EditContext(model);\n}\n```\n\n```razor\n\u003CEditForm EditContext=\"editContext\" OnValidSubmit=\"HandleSubmit\" FormName=\"employee\">\n```\n\n## Submit Handlers\n\n| Handler | Fires when | Use when |\n|---------|-----------|----------|\n| `OnValidSubmit` | Validation passes | Standard forms with `DataAnnotationsValidator` |\n| `OnInvalidSubmit` | Validation fails | Need custom handling for invalid state |\n| `OnSubmit` | Always — validation is manual | Using `EditContext.Validate()` yourself |\n\n`OnSubmit` cannot combine with `OnValidSubmit`\u002F`OnInvalidSubmit`.\n\n## Built-in Input Components\n\n| Component | Binds to | Notes |\n|-----------|----------|-------|\n| `InputText` | `string` | Renders `\u003Cinput type=\"text\">` |\n| `InputTextArea` | `string` | Renders `\u003Ctextarea>` |\n| `InputNumber\u003CT>` | `int`, `double`, `decimal` | Renders `\u003Cinput type=\"number\">` |\n| `InputDate\u003CT>` | `DateTime`, `DateOnly`, `DateTimeOffset` | Renders `\u003Cinput type=\"date\">` |\n| `InputCheckbox` | `bool` | Renders `\u003Cinput type=\"checkbox\">` |\n| `InputSelect\u003CT>` | `string`, enums, numeric types | Renders `\u003Cselect>` |\n| `InputRadioGroup\u003CT>` | `string`, enums, numeric types | Wraps `InputRadio\u003CT>` children |\n| `InputFile` | `IBrowserFile` | File upload — interactive modes only |\n\nAll input components use `@bind-Value` for binding. Always wrap text in a `\u003Clabel>` or use `id`\u002F`for` attributes for accessibility.\n\n### InputSelect with enum values\n\n```razor\n\u003CInputSelect @bind-Value=\"Model!.Status\">\n    \u003Coption value=\"\">-- Select --\u003C\u002Foption>\n    @foreach (var value in Enum.GetValues\u003COrderStatus>())\n    {\n        \u003Coption value=\"@value\">@value\u003C\u002Foption>\n    }\n\u003C\u002FInputSelect>\n```\n\n### InputRadioGroup\n\n```razor\n\u003CInputRadioGroup @bind-Value=\"Model!.Priority\">\n    @foreach (var p in Enum.GetValues\u003CPriority>())\n    {\n        \u003Clabel>\n            \u003CInputRadio Value=\"p\" \u002F> @p\n        \u003C\u002Flabel>\n    }\n\u003C\u002FInputRadioGroup>\n```\n\n## Validation\n\n### Data annotations\n\nDefine validation rules on the model:\n\n```csharp\npublic class EmployeeModel\n{\n    [Required, StringLength(100)]\n    public string? Name { get; set; }\n\n    [Required, EmailAddress]\n    public string? Email { get; set; }\n\n    [Range(18, 99)]\n    public int Age { get; set; }\n\n    [Required]\n    public string? Department { get; set; }\n}\n```\n\nAdd `\u003CDataAnnotationsValidator \u002F>` inside `EditForm` — without it, annotation attributes are silently ignored.\n\nDisplay errors with:\n- `\u003CValidationSummary \u002F>` — all errors in a list\n- `\u003CValidationMessage For=\"() => Model!.FieldName\" \u002F>` — per-field inline errors\n\n### Custom validator component\n\nFor server-round-trip validation (uniqueness checks, business rules):\n\n```csharp\npublic class CustomValidator : ComponentBase\n{\n    [CascadingParameter]\n    private EditContext? EditContext { get; set; }\n\n    private ValidationMessageStore? messageStore;\n\n    protected override void OnInitialized()\n    {\n        messageStore = new ValidationMessageStore(EditContext!);\n        EditContext!.OnValidationRequested += (s, e) => messageStore.Clear();\n        EditContext!.OnFieldChanged += (s, e) => messageStore.Clear(e.FieldIdentifier);\n    }\n\n    public void DisplayErrors(Dictionary\u003Cstring, List\u003Cstring>> errors)\n    {\n        foreach (var (field, messages) in errors)\n        {\n            foreach (var message in messages)\n            {\n                messageStore!.Add(EditContext!.Field(field), message);\n            }\n        }\n        EditContext!.NotifyValidationStateChanged();\n    }\n\n    public void ClearErrors()\n    {\n        messageStore?.Clear();\n        EditContext?.NotifyValidationStateChanged();\n    }\n}\n```\n\nUsage in a form:\n\n```razor\n\u003CEditForm Model=\"Model\" OnValidSubmit=\"HandleSubmit\" FormName=\"register\">\n    \u003CDataAnnotationsValidator \u002F>\n    \u003CCustomValidator @ref=\"customValidator\" \u002F>\n    \u003CValidationSummary \u002F>\n    @* inputs *@\n\u003C\u002FEditForm>\n\n@code {\n    private CustomValidator? customValidator;\n\n    private async Task HandleSubmit()\n    {\n        var errors = await RegistrationService.ValidateAsync(Model!);\n        if (errors.Count > 0)\n        {\n            customValidator!.DisplayErrors(errors);\n            return;\n        }\n        \u002F\u002F proceed\n    }\n}\n```\n\n## React to Input Changes (Interactive Only)\n\n### @bind:after\n\nRun logic after a bound value changes:\n\n```razor\n\u003CInputText @bind-Value=\"Model!.ZipCode\" @bind:after=\"OnZipCodeChanged\" \u002F>\n\n@code {\n    private async Task OnZipCodeChanged()\n    {\n        \u002F\u002F Fetch city\u002Fstate based on new zip code\n        var location = await LocationService.LookupAsync(Model!.ZipCode);\n        Model.City = location?.City;\n        Model.State = location?.State;\n    }\n}\n```\n\n### @oninput for real-time filtering\n\n```razor\n\u003Cinput type=\"text\" @oninput=\"OnSearchInput\" placeholder=\"Search...\" \u002F>\n\n@code {\n    private string searchTerm = \"\";\n    private List\u003CItem> filteredItems = new();\n\n    private void OnSearchInput(ChangeEventArgs e)\n    {\n        searchTerm = e.Value?.ToString() ?? \"\";\n        filteredItems = allItems.Where(i =>\n            i.Name.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)).ToList();\n    }\n}\n```\n\n## SSR-Specific Patterns\n\nThese apply when the form renders in Static SSR (mode = None, or per-page without `@rendermode`).\n\n### SupplyParameterFromForm\n\nBinds POST data to a property on form submission:\n\n```csharp\n[SupplyParameterFromForm]\nprivate ContactModel? Contact { get; set; }\n\nprotected override void OnInitialized() => Contact ??= new();\n```\n\n**Critical:** The `??=` in `OnInitialized` is required. On GET the property is null — `??=` creates the model. On POST the framework populates it — `??=` preserves the posted values.\n\n### FormName — multiple forms on one page\n\nEach form needs a unique `FormName`:\n\n```razor\n\u003CEditForm Model=\"Search\" OnSubmit=\"DoSearch\" FormName=\"search\">...\u003C\u002FEditForm>\n\u003CEditForm Model=\"Contact\" OnValidSubmit=\"SaveContact\" FormName=\"contact\">...\u003C\u002FEditForm>\n```\n\nMatch `[SupplyParameterFromForm]` to its form:\n\n```csharp\n[SupplyParameterFromForm(FormName = \"search\")]\nprivate SearchModel? Search { get; set; }\n\n[SupplyParameterFromForm(FormName = \"contact\")]\nprivate ContactModel? Contact { get; set; }\n```\n\n### Enhanced navigation for forms\n\nAdd `Enhance` for SPA-like form submissions without full page reload:\n\n```razor\n\u003CEditForm Model=\"Model\" OnValidSubmit=\"Save\" FormName=\"quick\" Enhance>\n```\n\nEnhanced forms submit via `fetch`, patch the DOM, and preserve scroll position. The page stays interactive-feeling even in SSR.\n\n### Plain HTML forms\n\nWhen using raw `\u003Cform>` instead of `EditForm` in SSR, add the antiforgery token manually:\n\n```razor\n\u003Cform method=\"post\" @onsubmit=\"Submit\" @formname=\"raw-form\">\n    \u003CAntiforgeryToken \u002F>\n    \u003Cinput name=\"Model.Name\" value=\"@Model?.Name\" \u002F>\n    \u003Cbutton type=\"submit\">Send\u003C\u002Fbutton>\n\u003C\u002Fform>\n```\n\n`EditForm` includes the antiforgery token automatically.\n\n## File Upload\n\n`InputFile` works in **interactive modes only** — not in Static SSR.\n\n```razor\n\u003CInputFile OnChange=\"OnFileSelected\" accept=\".pdf,.jpg,.png\" \u002F>\n\n@code {\n    private IBrowserFile? selectedFile;\n\n    private async Task OnFileSelected(InputFileChangeEventArgs e)\n    {\n        selectedFile = e.File;\n\n        \u002F\u002F Read stream with size limit\n        await using var stream = selectedFile.OpenReadStream(maxAllowedSize: 10 * 1024 * 1024);\n        \u002F\u002F Process stream — save to disk, upload to storage, etc.\n    }\n}\n```\n\nStream size limits:\n- **Server:** Default ~30 KB SignalR message size. Call `OpenReadStream(maxAllowedSize)` to increase. Large files stream over the circuit.\n- **WebAssembly:** File is read in the browser. No SignalR limit, but memory constrained.\n\nFor multiple files:\n\n```razor\n\u003CInputFile OnChange=\"OnFilesSelected\" multiple \u002F>\n\n@code {\n    private async Task OnFilesSelected(InputFileChangeEventArgs e)\n    {\n        foreach (var file in e.GetMultipleFiles(maxAllowedFiles: 10))\n        {\n            await using var stream = file.OpenReadStream(maxAllowedSize: 10 * 1024 * 1024);\n            \u002F\u002F Process each file\n        }\n    }\n}\n```\n\n## Prevent Double Submission\n\nDisable the submit button while processing:\n\n```razor\n\u003Cbutton type=\"submit\" disabled=\"@isSubmitting\">\n    @(isSubmitting ? \"Saving...\" : \"Save\")\n\u003C\u002Fbutton>\n\n@code {\n    private bool isSubmitting;\n\n    private async Task HandleSubmit()\n    {\n        isSubmitting = true;\n        try\n        {\n            await SaveService.SaveAsync(Model!);\n        }\n        finally\n        {\n            isSubmitting = false;\n        }\n    }\n}\n```\n\n## Custom Validation CSS\n\nReplace the default `valid`\u002F`invalid` CSS classes:\n\n```csharp\npublic class BootstrapFieldCssClassProvider : FieldCssClassProvider\n{\n    public override string GetFieldCssClass(EditContext editContext, in FieldIdentifier fieldIdentifier)\n    {\n        var isValid = !editContext.GetValidationMessages(fieldIdentifier).Any();\n        return editContext.IsModified(fieldIdentifier)\n            ? (isValid ? \"is-valid\" : \"is-invalid\")\n            : \"\";\n    }\n}\n```\n\nApply to the form:\n\n```csharp\nprotected override void OnInitialized()\n{\n    editContext = new EditContext(model);\n    editContext.SetFieldCssClassProvider(new BootstrapFieldCssClassProvider());\n}\n```\n\n## Don'ts\n\n- Don't use `@bind` or `@oninput` in Static SSR forms — they require interactivity. Use `[SupplyParameterFromForm]` and `FormName`.\n- Don't forget `Model ??= new()` in `OnInitialized` — the model is null on GET, populated on POST.\n- Don't use `OnSubmit` together with `OnValidSubmit`\u002F`OnInvalidSubmit` — they're mutually exclusive.\n- Don't omit `\u003CDataAnnotationsValidator \u002F>` — validation attributes are silently ignored without it.\n- Don't omit `FormName` in SSR when a page has multiple forms — both forms will fire on any submission.\n- Don't use `InputFile` in Static SSR — it requires an interactive render mode.\n- Don't use both `Model` and `EditContext` on an `EditForm` — pick one.\n- Don't forget `\u003CAntiforgeryToken \u002F>` in plain `\u003Cform>` elements — the server rejects the POST without it.\n","# Collect User Input\n\n## Step 1 — Read the Project's AGENTS.md\n\nCheck `AGENTS.md` for **Interactivity Mode** and **Interactivity Scope**. This determines which form patterns apply:\n\n| Mode | Form mechanism |\n|------|---------------|\n| None (Static SSR) | `EditForm` with `FormName` + `[SupplyParameterFromForm]`. No `@bind`, no `@onchange`. |\n| Server | `EditForm` with `@bind-Value`. Full interactivity — real-time validation, dynamic UI. |\n| WebAssembly | Same as Server, but validators needing server data must call APIs. |\n| Auto | Same as WebAssembly — code must work in both browser and server. |\n\n| Scope | Impact |\n|-------|--------|\n| Global | All forms are interactive. `FormName` only needed when explicitly opting a page to static SSR. |\n| Per-page | Forms in static pages use `FormName` + `[SupplyParameterFromForm]`. Forms in `@rendermode` pages use `@bind-Value`. |\n\n## EditForm Setup\n\n`EditForm` requires **either** `Model` or `EditContext` — never both.\n\n### Model-based (default)\n\n```razor\n\u003CEditForm Model=\"Employee\" OnValidSubmit=\"HandleSubmit\" FormName=\"employee\">\n    \u003CDataAnnotationsValidator \u002F>\n    \u003CValidationSummary \u002F>\n\n    \u003Clabel>\n        Name: \u003CInputText @bind-Value=\"Employee!.Name\" \u002F>\n        \u003CValidationMessage For=\"() => Employee!.Name\" \u002F>\n    \u003C\u002Flabel>\n\n    \u003Cbutton type=\"submit\">Save\u003C\u002Fbutton>\n\u003C\u002FEditForm>\n\n@code {\n    [SupplyParameterFromForm]\n    private EmployeeModel? Employee { get; set; }\n\n    protected override void OnInitialized() => Employee ??= new();\n\n    private async Task HandleSubmit()\n    {\n        \u002F\u002F Save Employee\n    }\n}\n```\n\nThis single pattern works in **both** SSR and interactive modes:\n- In SSR: `FormName` identifies the form, `[SupplyParameterFromForm]` binds POST data, `??=` initializes on GET.\n- In interactive: `@bind-Value` provides two-way binding, `[SupplyParameterFromForm]` is ignored, `FormName` is harmless.\n\n### EditContext-based (advanced)\n\nUse when you need programmatic field tracking, dynamic validation rules, or manual `EditContext.Validate()` calls:\n\n```csharp\nprivate EditContext? editContext;\nprivate EmployeeModel model = new();\n\nprotected override void OnInitialized()\n{\n    editContext = new EditContext(model);\n}\n```\n\n```razor\n\u003CEditForm EditContext=\"editContext\" OnValidSubmit=\"HandleSubmit\" FormName=\"employee\">\n```\n\n## Submit Handlers\n\n| Handler | Fires when | Use when |\n|---------|-----------|----------|\n| `OnValidSubmit` | Validation passes | Standard forms with `DataAnnotationsValidator` |\n| `OnInvalidSubmit` | Validation fails | Need custom handling for invalid state |\n| `OnSubmit` | Always — validation is manual | Using `EditContext.Validate()` yourself |\n\n`OnSubmit` cannot combine with `OnValidSubmit`\u002F`OnInvalidSubmit`.\n\n## Built-in Input Components\n\n| Component | Binds to | Notes |\n|-----------|----------|-------|\n| `InputText` | `string` | Renders `\u003Cinput type=\"text\">` |\n| `InputTextArea` | `string` | Renders `\u003Ctextarea>` |\n| `InputNumber\u003CT>` | `int`, `double`, `decimal` | Renders `\u003Cinput type=\"number\">` |\n| `InputDate\u003CT>` | `DateTime`, `DateOnly`, `DateTimeOffset` | Renders `\u003Cinput type=\"date\">` |\n| `InputCheckbox` | `bool` | Renders `\u003Cinput type=\"checkbox\">` |\n| `InputSelect\u003CT>` | `string`, enums, numeric types | Renders `\u003Cselect>` |\n| `InputRadioGroup\u003CT>` | `string`, enums, numeric types | Wraps `InputRadio\u003CT>` children |\n| `InputFile` | `IBrowserFile` | File upload — interactive modes only |\n\nAll input components use `@bind-Value` for binding. Always wrap text in a `\u003Clabel>` or use `id`\u002F`for` attributes for accessibility.\n\n### InputSelect with enum values\n\n```razor\n\u003CInputSelect @bind-Value=\"Model!.Status\">\n    \u003Coption value=\"\">-- Select --\u003C\u002Foption>\n    @foreach (var value in Enum.GetValues\u003COrderStatus>())\n    {\n        \u003Coption value=\"@value\">@value\u003C\u002Foption>\n    }\n\u003C\u002FInputSelect>\n```\n\n### InputRadioGroup\n\n```razor\n\u003CInputRadioGroup @bind-Value=\"Model!.Priority\">\n    @foreach (var p in Enum.GetValues\u003CPriority>())\n    {\n        \u003Clabel>\n            \u003CInputRadio Value=\"p\" \u002F> @p\n        \u003C\u002Flabel>\n    }\n\u003C\u002FInputRadioGroup>\n```\n\n## Validation\n\n### Data annotations\n\nDefine validation rules on the model:\n\n```csharp\npublic class EmployeeModel\n{\n    [Required, StringLength(100)]\n    public string? Name { get; set; }\n\n    [Required, EmailAddress]\n    public string? Email { get; set; }\n\n    [Range(18, 99)]\n    public int Age { get; set; }\n\n    [Required]\n    public string? Department { get; set; }\n}\n```\n\nAdd `\u003CDataAnnotationsValidator \u002F>` inside `EditForm` — without it, annotation attributes are silently ignored.\n\nDisplay errors with:\n- `\u003CValidationSummary \u002F>` — all errors in a list\n- `\u003CValidationMessage For=\"() => Model!.FieldName\" \u002F>` — per-field inline errors\n\n### Custom validator component\n\nFor server-round-trip validation (uniqueness checks, business rules):\n\n```csharp\npublic class CustomValidator : ComponentBase\n{\n    [CascadingParameter]\n    private EditContext? EditContext { get; set; }\n\n    private ValidationMessageStore? messageStore;\n\n    protected override void OnInitialized()\n    {\n        messageStore = new ValidationMessageStore(EditContext!);\n        EditContext!.OnValidationRequested += (s, e) => messageStore.Clear();\n        EditContext!.OnFieldChanged += (s, e) => messageStore.Clear(e.FieldIdentifier);\n    }\n\n    public void DisplayErrors(Dictionary\u003Cstring, List\u003Cstring>> errors)\n    {\n        foreach (var (field, messages) in errors)\n        {\n            foreach (var message in messages)\n            {\n                messageStore!.Add(EditContext!.Field(field), message);\n            }\n        }\n        EditContext!.NotifyValidationStateChanged();\n    }\n\n    public void ClearErrors()\n    {\n        messageStore?.Clear();\n        EditContext?.NotifyValidationStateChanged();\n    }\n}\n```\n\nUsage in a form:\n\n```razor\n\u003CEditForm Model=\"Model\" OnValidSubmit=\"HandleSubmit\" FormName=\"register\">\n    \u003CDataAnnotationsValidator \u002F>\n    \u003CCustomValidator @ref=\"customValidator\" \u002F>\n    \u003CValidationSummary \u002F>\n    @* inputs *@\n\u003C\u002FEditForm>\n\n@code {\n    private CustomValidator? customValidator;\n\n    private async Task HandleSubmit()\n    {\n        var errors = await RegistrationService.ValidateAsync(Model!);\n        if (errors.Count > 0)\n        {\n            customValidator!.DisplayErrors(errors);\n            return;\n        }\n        \u002F\u002F proceed\n    }\n}\n```\n\n## React to Input Changes (Interactive Only)\n\n### @bind:after\n\nRun logic after a bound value changes:\n\n```razor\n\u003CInputText @bind-Value=\"Model!.ZipCode\" @bind:after=\"OnZipCodeChanged\" \u002F>\n\n@code {\n    private async Task OnZipCodeChanged()\n    {\n        \u002F\u002F Fetch city\u002Fstate based on new zip code\n        var location = await LocationService.LookupAsync(Model!.ZipCode);\n        Model.City = location?.City;\n        Model.State = location?.State;\n    }\n}\n```\n\n### @oninput for real-time filtering\n\n```razor\n\u003Cinput type=\"text\" @oninput=\"OnSearchInput\" placeholder=\"Search...\" \u002F>\n\n@code {\n    private string searchTerm = \"\";\n    private List\u003CItem> filteredItems = new();\n\n    private void OnSearchInput(ChangeEventArgs e)\n    {\n        searchTerm = e.Value?.ToString() ?? \"\";\n        filteredItems = allItems.Where(i =>\n            i.Name.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)).ToList();\n    }\n}\n```\n\n## SSR-Specific Patterns\n\nThese apply when the form renders in Static SSR (mode = None, or per-page without `@rendermode`).\n\n### SupplyParameterFromForm\n\nBinds POST data to a property on form submission:\n\n```csharp\n[SupplyParameterFromForm]\nprivate ContactModel? Contact { get; set; }\n\nprotected override void OnInitialized() => Contact ??= new();\n```\n\n**Critical:** The `??=` in `OnInitialized` is required. On GET the property is null — `??=` creates the model. On POST the framework populates it — `??=` preserves the posted values.\n\n### FormName — multiple forms on one page\n\nEach form needs a unique `FormName`:\n\n```razor\n\u003CEditForm Model=\"Search\" OnSubmit=\"DoSearch\" FormName=\"search\">...\u003C\u002FEditForm>\n\u003CEditForm Model=\"Contact\" OnValidSubmit=\"SaveContact\" FormName=\"contact\">...\u003C\u002FEditForm>\n```\n\nMatch `[SupplyParameterFromForm]` to its form:\n\n```csharp\n[SupplyParameterFromForm(FormName = \"search\")]\nprivate SearchModel? Search { get; set; }\n\n[SupplyParameterFromForm(FormName = \"contact\")]\nprivate ContactModel? Contact { get; set; }\n```\n\n### Enhanced navigation for forms\n\nAdd `Enhance` for SPA-like form submissions without full page reload:\n\n```razor\n\u003CEditForm Model=\"Model\" OnValidSubmit=\"Save\" FormName=\"quick\" Enhance>\n```\n\nEnhanced forms submit via `fetch`, patch the DOM, and preserve scroll position. The page stays interactive-feeling even in SSR.\n\n### Plain HTML forms\n\nWhen using raw `\u003Cform>` instead of `EditForm` in SSR, add the antiforgery token manually:\n\n```razor\n\u003Cform method=\"post\" @onsubmit=\"Submit\" @formname=\"raw-form\">\n    \u003CAntiforgeryToken \u002F>\n    \u003Cinput name=\"Model.Name\" value=\"@Model?.Name\" \u002F>\n    \u003Cbutton type=\"submit\">Send\u003C\u002Fbutton>\n\u003C\u002Fform>\n```\n\n`EditForm` includes the antiforgery token automatically.\n\n## File Upload\n\n`InputFile` works in **interactive modes only** — not in Static SSR.\n\n```razor\n\u003CInputFile OnChange=\"OnFileSelected\" accept=\".pdf,.jpg,.png\" \u002F>\n\n@code {\n    private IBrowserFile? selectedFile;\n\n    private async Task OnFileSelected(InputFileChangeEventArgs e)\n    {\n        selectedFile = e.File;\n\n        \u002F\u002F Read stream with size limit\n        await using var stream = selectedFile.OpenReadStream(maxAllowedSize: 10 * 1024 * 1024);\n        \u002F\u002F Process stream — save to disk, upload to storage, etc.\n    }\n}\n```\n\nStream size limits:\n- **Server:** Default ~30 KB SignalR message size. Call `OpenReadStream(maxAllowedSize)` to increase. Large files stream over the circuit.\n- **WebAssembly:** File is read in the browser. No SignalR limit, but memory constrained.\n\nFor multiple files:\n\n```razor\n\u003CInputFile OnChange=\"OnFilesSelected\" multiple \u002F>\n\n@code {\n    private async Task OnFilesSelected(InputFileChangeEventArgs e)\n    {\n        foreach (var file in e.GetMultipleFiles(maxAllowedFiles: 10))\n        {\n            await using var stream = file.OpenReadStream(maxAllowedSize: 10 * 1024 * 1024);\n            \u002F\u002F Process each file\n        }\n    }\n}\n```\n\n## Prevent Double Submission\n\nDisable the submit button while processing:\n\n```razor\n\u003Cbutton type=\"submit\" disabled=\"@isSubmitting\">\n    @(isSubmitting ? \"Saving...\" : \"Save\")\n\u003C\u002Fbutton>\n\n@code {\n    private bool isSubmitting;\n\n    private async Task HandleSubmit()\n    {\n        isSubmitting = true;\n        try\n        {\n            await SaveService.SaveAsync(Model!);\n        }\n        finally\n        {\n            isSubmitting = false;\n        }\n    }\n}\n```\n\n## Custom Validation CSS\n\nReplace the default `valid`\u002F`invalid` CSS classes:\n\n```csharp\npublic class BootstrapFieldCssClassProvider : FieldCssClassProvider\n{\n    public override string GetFieldCssClass(EditContext editContext, in FieldIdentifier fieldIdentifier)\n    {\n        var isValid = !editContext.GetValidationMessages(fieldIdentifier).Any();\n        return editContext.IsModified(fieldIdentifier)\n            ? (isValid ? \"is-valid\" : \"is-invalid\")\n            : \"\";\n    }\n}\n```\n\nApply to the form:\n\n```csharp\nprotected override void OnInitialized()\n{\n    editContext = new EditContext(model);\n    editContext.SetFieldCssClassProvider(new BootstrapFieldCssClassProvider());\n}\n```\n\n## Don'ts\n\n- Don't use `@bind` or `@oninput` in Static SSR forms — they require interactivity. Use `[SupplyParameterFromForm]` and `FormName`.\n- Don't forget `Model ??= new()` in `OnInitialized` — the model is null on GET, populated on POST.\n- Don't use `OnSubmit` together with `OnValidSubmit`\u002F`OnInvalidSubmit` — they're mutually exclusive.\n- Don't omit `\u003CDataAnnotationsValidator \u002F>` — validation attributes are silently ignored without it.\n- Don't omit `FormName` in SSR when a page has multiple forms — both forms will fire on any submission.\n- Don't use `InputFile` in Static SSR — it requires an interactive render mode.\n- Don't use both `Model` and `EditContext` on an `EditForm` — pick one.\n- Don't forget `\u003CAntiforgeryToken \u002F>` in plain `\u003Cform>` elements — the server rejects the POST without it.\n",{"name":5,"license":15,"description":7},"main","497cc9aba79a931ac6fb8d36a48cc22fe3d6d74b","external-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet-blazor\u002Fskills\u002Fcollect-user-input",41,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills","https:\u002F\u002Fskills.managed-code.com","https:\u002F\u002Fgithub.com\u002Fmanagedcode","https:\u002F\u002Fwww.managed-code.com","Open Source Community for .NET Developers: Reliable, Actively Maintained, and Community-Driven. Made in Ukraine 🇺🇦 with ❤️","2026-11-14 19:05:44",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add managedcode\u002Fdotnet-skills --skill collect-user-input",{"tool":62,"command":63},"bunx","bunx skills add managedcode\u002Fdotnet-skills --skill collect-user-input",{"tool":65,"command":66},"pnpm","pnpm dlx skills add managedcode\u002Fdotnet-skills --skill collect-user-input","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet-blazor\u002Fskills\u002Fcollect-user-input\u002FSKILL.md",true,[],[71,97,114,146,156,182],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":41},"01M6DYQE1Y9FHAQHEDTVFQ3447","xtwitter-scraper","Use XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API client usage; modeling API-key configuration, pagination, binary exports, raw responses, retries, and webhook\u002Fevent flows in .NET. DO NOT USE FOR: unrelated stacks; direct browser automation; generic social-media strategy; or code that does not call Xquik. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FXTwitterScraper\u002Fskills\u002Fxtwitter-scraper\u002FSKILL.md",[],[78,79,80,81,82,83,34,84,85,86,87,88,89,90,91,92,93,94,95,96],"xtwitter scraper","browser automation","workflows","run","code","browser","repository","api","Media","api client","access","edit","unrelated","webhooks","files","social","commands","modeling","webhook",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":41},"01M6DYQ9S4PE1H6G8MCH9T21HR","sep","Use Sep for high-performance separated-value parsing and writing in .NET, including delimiter inference, explicit parser\u002Fwriter options, and low-allocation row\u002Fcolumn workflows. USE FOR: delimited data needs are performance-sensitive and allocation-aware; project needs explicit control over separator inference, escaping, trimming, and header behavior;. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FSep\u002Fskills\u002Fsep\u002FSKILL.md",[],[99,104,105,80,106,81,84,32,107,108,89,109,90,92,110,111,112,29,94,113],"writing","performance","tasks","parsing","parser","context","do","writer","options","high-performance",{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":41},"01M6DZS2DNEPXCGGF6SSCW6G5V","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fwebgpu-claude-skill\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145],"webgpu","threejs","webgpu threejs tsl","setup","shaders","gpu","integration","applications","js","node","syntax","guide","use","language","three","compute","post","processing","with","renderer","for","materials","wgsl","effects","when",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":41},"01M6DZS0BQXW2B56A289XF1X76","roslynk","Use Roslynk for semantic inspection and edits of *.cs, *.razor and *.cshtml solution files.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Froslynk\u002Fskills\u002Froslynk\u002FSKILL.md",[],[148,133,92,153,154,141,155],"semantic","razor","inspection",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":41},"01M6DZRW6MEJCVW80K3S4XV60K","system-text-json-net11","Imperative guidance for the System.Text.Json APIs added in .NET 11: the built-in `JsonNamingPolicy.PascalCase` naming policy, and the strongly-typed generic `JsonSerializerOptions.GetTypeInfo` and `JsonSerializerOptions.TryGetTypeInfo` metadata accessors (generic overloads that return a typed `JsonTypeInfo`). USE ONLY when the user is targeting net11.0 or later and needs PascalCase JSON property or dictionary-key names without writing a custom naming policy, a strongly-typed generic `JsonTypeInfo` instead of the non-generic `JsonTypeInfo`, or a no-throw way to probe whether a type's serialization metadata is resolved. DO NOT USE when the target is earlier than net11.0, the requested behavior uses an established pre-net11 naming policy, or the user explicitly selected another JSON library.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[163,164,165,166,104,167,168,169,170,171,22,133,172,173,174,175,110,176,177,178,179,141,180,181,145],"system","json","text","system text json net11","policy","metadata","library","serialization","behavior","only","probe","guidance","later","type","dictionary","naming","targeting","custom","generic",{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":188,"publishedAt":41},"01M6DZRRJP3S662NFSG1RSPQQ7","process-api-net11","Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText\u002FBytes\u002FLines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fprocess-api-net11\u002FSKILL.md",[],[85,189,190,191,81,192,128,163,133,174,175,110,193,194,195,196,179,141,197],"process","process api net11","diagnostics","start","basic","processes","output","usage","new"]