Skip to content

Add EditContext.IsValid(..) to determine if a field has any associated validation messages. #31252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pranavkm opened this issue Mar 25, 2021 · 6 comments · Fixed by #48698
Closed
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-builtin-components Features related to the built in components we ship or could ship in the future feature-blazor-form-validation This issue is related to forms validation in Blazor good first issue Good for newcomers. help wanted Up for grabs. We would accept a PR to help resolve this issue Priority:2 Work that is important, but not critical for the release
Milestone

Comments

@pranavkm
Copy link
Contributor

Background and Motivation

Proposed API

Add an API to query if a FieldIdentifier is valid without having to get validation messages. We have several places that get the messages only to determine this condition e.g. https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web/src/Forms/InputBase.cs#L245

This has the sneaky benefit of removing yet another Linq call because we do something more optimized to determine this condition.

Usage Examples

// some lines of code here
var isValid = EditContext.IsValid(FieldIdentifier);
if (!isValid)
{
   // Do stuff
}

Alternative Designs

Risks

@pranavkm pranavkm added api-suggestion Early API idea and discussion, it is NOT ready for implementation area-blazor Includes: Blazor, Razor Components labels Mar 25, 2021
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Mar 29, 2021
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Mar 29, 2021
@mkArtakMSFT mkArtakMSFT added the feature-blazor-form-validation This issue is related to forms validation in Blazor label Mar 29, 2021
@ghost
Copy link

ghost commented Mar 29, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@dotnet dotnet deleted a comment Mar 29, 2021
@javiercn javiercn added the feature-blazor-builtin-components Features related to the built in components we ship or could ship in the future label Apr 20, 2021
@TanayParikh
Copy link
Contributor

@pranavkm is this something you envision for 7.0?

@TanayParikh TanayParikh added the Priority:1 Work that is critical for the release, but we could probably ship without label Oct 22, 2021
@mkArtakMSFT mkArtakMSFT added Priority:2 Work that is important, but not critical for the release triaged and removed Priority:1 Work that is critical for the release, but we could probably ship without labels Oct 28, 2021
@mkArtakMSFT mkArtakMSFT added good first issue Good for newcomers. help wanted Up for grabs. We would accept a PR to help resolve this issue labels Sep 14, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 8 Planning, Backlog Sep 14, 2022
@ghost
Copy link

ghost commented Sep 14, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, .NET 8 Planning Oct 19, 2022
@ghost
Copy link

ghost commented Oct 19, 2022

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@rasaconsulting-sandy
Copy link

This would be a great enhancement!

@ghost
Copy link

ghost commented Jun 29, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@mkArtakMSFT mkArtakMSFT modified the milestones: Backlog, 8.0-rc1 Aug 14, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-blazor Includes: Blazor, Razor Components enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-builtin-components Features related to the built in components we ship or could ship in the future feature-blazor-form-validation This issue is related to forms validation in Blazor good first issue Good for newcomers. help wanted Up for grabs. We would accept a PR to help resolve this issue Priority:2 Work that is important, but not critical for the release
Projects
None yet
8 participants