Skip to content

Add method to indicate an event handler should enforce value consistency #17281

@SteveSandersonMS

Description

@SteveSandersonMS

In other words, a way to tell Blazor that a given event handler is part of a two-way binding even if you're not using @bind.

It would probably look like this:

<input value="@MyValue" @onchange="MyHandler" @onchange:enforceConsistency />

... or maybe @onchange:sync or @onchange:twoWay. The implementation is simply to emit a builder.SetUpdatesAttributeName call for whatever is the "value" attribute for this element type (e.g., on <input type=checkbox> it would call builder.SetUpdatesAttributeName("checked");).

For more details about the scenario and justification for this design, see #17099 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-mediumThis issue impacts approximately half of our customersarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-component-modelAny feature that affects the component model for Blazor (Parameters, Rendering, Lifecycle, etc)severity-blockingThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions