Skip to content
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

Blazor and Razor Pages CRUD scaffolding should visually indicate which fields are required #2899

Open
MackinnonBuck opened this issue Jul 29, 2024 · 1 comment

Comments

@MackinnonBuck
Copy link
Member

Overview

Currently, when a form gets generated from a model class, there is no visual indication of which form fields are required. The user must first submit the form before getting feedback about which form fields are required.

Proposed fixes

For each form input that gets generated from a model property annotated with a RequiredAttribute, include additional markup to indicate that the field is required. For example:

<div class="mb-3">
+   <span class="text-danger">*</span>
    <label for="title" class="form-label">Title:</label>
    <InputText id="title" @bind-Value="Movie.Title" class="form-control" aria-required="true" />
    <ValidationMessage For="() => Movie.Title" class="text-danger" />
</div>

Before

image

After

image

@MackinnonBuck
Copy link
Member Author

Related: dotnet/aspnetcore#56312

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant