Skip to content

Commit 8e20dca

Browse files
authored
Form name attribute coverage
1 parent 525450c commit 8e20dca

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

aspnetcore/blazor/forms/binding.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,15 @@ To use the preceding component in the [starship example form (`Starship3.razor`/
464464
+ <EngineeringApprovalInputDerived @bind-Value="Model!.IsValidatedDesign" />
465465
```
466466

467+
If the component that inherits from <xref:Microsoft.AspNetCore.Components.Forms.InputBase%601> is ever statically rendered, assign the <xref:Microsoft.AspNetCore.Components.Forms.InputBase%601.NameAttributeValue?displayProperty=nameWithType> property to the `name` attribute of `<input>` elements:
468+
469+
```razor
470+
<input @bind="CurrentValue" @bind:after="AfterChange" class="@CssClass"
471+
type="checkbox" name="@NameAttributeValue" />
472+
```
473+
474+
The preceding assignment isn't necessary if the component is guaranteed to always render interactively.
475+
467476
### Input component with full developer control
468477

469478
The following example component:

0 commit comments

Comments
 (0)