[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D13SNK7PW7QTNHSVE4AYRP":3,"skill-same:01M7D13SNK7PW7QTNHSVE4AYRP":44},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7D13SNK7PW7QTNHSVE4AYRP","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).","itsmejay18\u002FAI-Skills-for-My-Development-Stack","itsmejay18","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F167779943?v=4","01M7CZRFC6DDZA5V2CX8WDSZED","Jay Jemino Ababon ","01M7CZRFCVRNW1SFHSQXEJ3CQN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F04-Frontend-Web-Development\u002Fcollect-user-input\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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","30954af1dcd1a74b63f05deb2e2c41e5ecae4a82","04-Frontend-Web-Development\u002Fcollect-user-input","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack","https:\u002F\u002Fgithub.com\u002Fitsmejay18","2026-09-18 16:06:36",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill collect-user-input",{"tool":36,"command":37},"bunx","bunx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill collect-user-input",{"tool":39,"command":40},"pnpm","pnpm dlx skills add itsmejay18\u002FAI-Skills-for-My-Development-Stack --skill collect-user-input","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F04-Frontend-Web-Development\u002Fcollect-user-input\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7D2RKBHPZ3E1RNN5DWHT550","vectorization","Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives, Vector64\u002F128\u002F256\u002F512, or platform hardware intrinsics; reviewing existing SIMD code, including Vector\u003CT>, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. DO NOT USE FOR: performance work unrelated to SIMD or vectorization.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7D2RDJ7RN3QK8GJR0QTER1D","resolve-project-references","Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries. Activate when ResolveProjectReferences appears as the most expensive target and developers are trying to optimize it directly. Explains that the reported time includes wait time for dependent project builds and is misleading. Guides users to focus on task self-time instead. Do not activate for general build performance -- use build-perf-diagnostics instead.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fresolve-project-references\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7D2R1H2GTNZYHG9YRX3JDQW","optimizing-ef-core-queries","Optimize and improve the performance of slow Entity Framework Core (EF Core) queries: make them generate less SQL, make fewer database round-trips, and return results faster. Use whenever an EF Core or DbContext query or data-access path is slow or should be made faster — whether or not EF Core owns the database schema. For EF Core, not Dapper or raw ADO.NET.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Foptimizing-ef-core-queries\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7D2QREG04W1YT0NEBHEW5C9","microbenchmarking","Activate this skill when BenchmarkDotNet (BDN) is involved in the task — creating, running, configuring, or reviewing BDN benchmarks. Also activate when microbenchmarking .NET code would be useful and BenchmarkDotNet is the likely tool. Consider activating when answering a .NET performance question requires measurement and BenchmarkDotNet may be needed. Covers microbenchmark design, BDN configuration and project setup, how to run BDN microbenchmarks efficiently and effectively, and using BDN for side-by-side performance comparisons. Do NOT use for profiling\u002Ftracing .NET code (dotnet-trace, PerfView), production telemetry, or load\u002Fstress testing (Crank, k6).","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fmicrobenchmarking\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7D2QGE175XWPZVACVH2868Z","incremental-build","Guide for optimizing MSBuild incremental builds. USE FOR: builds slower than expected on subsequent runs, 'nothing changed but it rebuilds anyway', diagnosing why targets re-execute unnecessarily, fixing broken no-op builds. Covers 8 common causes: missing Inputs\u002FOutputs on custom targets, volatile properties in output paths (timestamps\u002FGUIDs), file writes outside tracked Outputs, missing FileWrites registration, glob changes, Visual Studio Fast Up-to-Date Check (FUTDC) issues. Key diagnostic: look for 'Building target completely' vs 'Skipping target' in binlog. DO NOT USE FOR: first-time build slowness (use build-perf-baseline), parallelism issues (use build-parallelism), evaluation-phase slowness (use eval-performance), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Fincremental-build\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7D2Q1DQTC6K49R73WQTTPSB","eval-performance","Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin\u002Fobj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I\u002FO ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with \u002Fpp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002Fitsmejay18\u002FAI-Skills-for-My-Development-Stack\u002Fblob\u002Fmain\u002F20-Performance-Optimization\u002Feval-performance\u002FSKILL.md",[],[]]