Skip to content

Commit 1b2e8d0

Browse files
committed
feat(Products): aplica validação no form de criação
1 parent 01a8c87 commit 1b2e8d0

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/BlazingShop/Products/CreateProduct/CreateProductPage.razor

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
<h1>New Product</h1>
66

7-
<EditForm Model="_model" OnValidSubmit="@HandleSubmitAsync">
7+
<EditForm Model="_model" OnValidSubmit="HandleSubmitAsync" FormName="@(nameof(CreateProductInput))">
8+
<DataAnnotationsValidator />
9+
<ValidationSummary />
10+
811
<div class="row mb-3">
912
<div class="col-9">
1013
<div class="mb-3">
@@ -41,4 +44,8 @@
4144
</div>
4245
</div>
4346
</div>
47+
48+
<button type="submit" class="btn btn-success">Save</button>
49+
<a href="/products" class="btn btn-secondary">Cancel</a>
50+
4451
</EditForm>

src/BlazingShop/Products/CreateProduct/CreateProductPage.razor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ namespace BlazingShop.Products.CreateProduct;
77

88
public partial class CreateProductPage
99
{
10-
1110
private readonly CreateProductInput _model = new();
1211

1312
private IEnumerable<GetCategoriesQuery> _categories = [];

0 commit comments

Comments
 (0)