Skip to content

Commit 341173d

Browse files
authored
Update 05-checkout-with-validation.md (#249)
Edit text.
1 parent f53b7c2 commit 341173d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/05-checkout-with-validation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ As usual, you'll need to `@inject` values for `OrderState`, `HttpClient`, and `N
4242
Next, let's bring customers here when they try to submit orders. Back in `Index.razor`, make sure you've deleted the `PlaceOrder` method, and then change the order submission button into a regular HTML link to the `/checkout` URL, i.e.:
4343

4444
```razor
45-
<a href="checkout" class="@(Order.Pizzas.Count == 0 ? "btn btn-warning disabled" : "btn btn-warning")">
45+
<a href="checkout" class="@(OrderState.Order.Pizzas.Count == 0 ? "btn btn-warning disabled" : "btn btn-warning")">
4646
Order >
4747
</a>
4848
```
4949

50-
Note that we removed the `disabled` attribute, since HTML links do not support it, and added appropriate styling instead.
50+
> Note that we removed the `disabled` attribute, since HTML links do not support it, and added appropriate styling instead.
5151
5252
Now, when you run the app, you should be able to reach the checkout page by clicking the *Order* button, and from there you can click *Place order* to confirm it.
5353

@@ -193,7 +193,7 @@ namespace BlazingPizza
193193
}
194194
```
195195

196-
Now, recompile and run your application, and you should be able to observe the validation rules being enforced on the server. If you try to submit an order with a blank delivery address, then the server will reject the request and you'll see an HTTP 400 ("Bad Request") error in the browser's *Network* tab:
196+
Now, after you recompile and run your application, you should be able to observe the validation rules being enforced on the server. If you try to submit an order with a blank delivery address, then the server will reject the request and you'll see an HTTP 400 ("Bad Request") error in the browser's *Network* tab:
197197

198198
![Server validation](https://user-images.githubusercontent.com/1874516/77242384-067af800-6bbb-11ea-8dd0-74f457d15afd.png)
199199

@@ -248,7 +248,7 @@ Next, instead of triggering `PlaceOrder` directly from the button, you need to t
248248

249249
As you can probably guess, the `<button>` no longer triggers `PlaceOrder` directly. Instead, the button just asks the form to be submitted. And then the form decides whether or not it's valid, and if it is, *then* it will call `PlaceOrder`.
250250

251-
Try it out: you should no longer be able to submit an invalid form, and you'll see validation messages (albeit unattractive ones).
251+
Try it out: you should no longer be able to submit an invalid form, and you'll see validation messages (albeit unattractive ones) where you placed the `ValidationSummary`.
252252

253253
![Validation summary](https://user-images.githubusercontent.com/1874516/77242430-9d47b480-6bbb-11ea-96ef-8865468375fb.png)
254254

0 commit comments

Comments
 (0)