Skip to content

Blazor: Separate Validate/StateChange concerns in EditContext #13595

Closed as not planned

Description

@mrpmorris

Is your feature request related to a problem? Please describe.

It is currently not possible to validate an individual field of an EditForm without also marking the field as modified.

Currently we can call EditContext.NotifyFieldChanged to invoke validation, but that also sets the FieldState.IsModified to true for that item in the form.

Describe the solution you'd like

Please separate change notification and validation requests for properties, so we can validate without marking the state as modified.

Add a ValidateProperty(FieldIdentifier) method to EditContext which invokes an OnFieldValidationRequested event that validation strategies can use to trigger validation.

NotifyFieldChanged and OnFieldChanged should remain as it might be useful to know when an individual property is changed.

Activity

  1. added this to the Backlog milestone on Sep 3, 2019
  2. added
    enhancementThis issue represents an ask for new feature or an enhancement to an existing one
    on Sep 3, 2019
  3. mkArtakMSFT commented on Sep 3, 2019

    @mkArtakMSFT
    Contributor

    We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources.

  4. mrpmorris commented on Sep 4, 2019

    @mrpmorris
    Author

    I'll happily provide the resources, it's only a few lines of code :)

  5. mrpmorris commented on Feb 6, 2020

    @mrpmorris
    Author

    Could this be considered please? It allows the validation of a sub-set of object properties without having to mark them as modified.

  6. mkArtakMSFT commented on Feb 10, 2020

    @mkArtakMSFT
    Contributor
  7. mkArtakMSFT commented on Oct 19, 2022

    @mkArtakMSFT
    Contributor

    Closing as this is a dupe of #31252

  8. ghost locked as resolved and limited conversation to collaborators on Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: DuplicateResolved as a duplicate of another issueStatus: Resolvedaffected-fewThis issue impacts only small number of customersarea-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-builtin-componentsFeatures related to the built in components we ship or could ship in the futurefeature-blazor-form-validationThis issue is related to forms validation in Blazorseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions