diff --git a/source/blazor-university-com/input/pages/components/code-generated-html-attributes/index.md b/source/blazor-university-com/input/pages/components/code-generated-html-attributes/index.md index 7693965..9af3989 100644 --- a/source/blazor-university-com/input/pages/components/code-generated-html-attributes/index.md +++ b/source/blazor-university-com/input/pages/components/code-generated-html-attributes/index.md @@ -94,7 +94,7 @@ In fact, even apply a value such as `false` will still activate them. The follow `readonly` and `disabled`. ```html - + ``` In razor views the rule is slightly different. diff --git a/source/blazor-university-com/input/pages/components/literals-expressions-and-directives/directives/index.md b/source/blazor-university-com/input/pages/components/literals-expressions-and-directives/directives/index.md index e3f3201..8bc4dee 100644 --- a/source/blazor-university-com/input/pages/components/literals-expressions-and-directives/directives/index.md +++ b/source/blazor-university-com/input/pages/components/literals-expressions-and-directives/directives/index.md @@ -24,7 +24,7 @@ An exception to this is when we wish to pass a lambda; lambdas must be escaped w The following code shows how the `@onclick` directive is used to add the DOM onclick event to a rendered H1 element. ```razor -// Razor mark-up with @ref directive +// Razor mark-up with @onclick directive

Hello, world!

@code diff --git a/source/blazor-university-com/input/pages/components/two-way-binding/binding-directives/index.md b/source/blazor-university-com/input/pages/components/two-way-binding/binding-directives/index.md index 872e2e0..0fdd4b2 100644 --- a/source/blazor-university-com/input/pages/components/two-way-binding/binding-directives/index.md +++ b/source/blazor-university-com/input/pages/components/two-way-binding/binding-directives/index.md @@ -24,7 +24,7 @@ For example, the `preventDefault` attribute applied to the `@onclick` directive a submit button from actually submitting a form. ```razor - + ``` In addition to these, it is also possible to assign values to some directive attributes in the following form: @@ -165,8 +165,8 @@ And something similar to the following (again abridged) code for converting user The code hooks into the HTML `onchange` event and then, via the binder, sets our member value when the event is triggered. -The different when setting the `@bind-value:format` directive attribute value is that the format we -provide passed in the generated code to both `BindConverter.Format` and `EventCallback.Factory.CreateBinder`. +The difference when setting the `@bind-value:format` directive attribute value is that the format we +provide is passed in the generated code to both `BindConverter.Format` and `EventCallback.Factory.CreateBinder`. ```cs ...BindConverter.FormatValue(Name, format: "yyyy-MM-dd"); diff --git a/source/blazor-university-com/input/pages/dependency-injection/component-scoped-dependencies/owning-multiple-dependencies-the-wrong-way/index.md b/source/blazor-university-com/input/pages/dependency-injection/component-scoped-dependencies/owning-multiple-dependencies-the-wrong-way/index.md index ace6e24..6bc49a5 100644 --- a/source/blazor-university-com/input/pages/dependency-injection/component-scoped-dependencies/owning-multiple-dependencies-the-wrong-way/index.md +++ b/source/blazor-university-com/input/pages/dependency-injection/component-scoped-dependencies/owning-multiple-dependencies-the-wrong-way/index.md @@ -41,7 +41,7 @@ public interface IOwnedDependency public int InstanceNumber { get; } } -public class OwnedDependency : IDependencyOne +public class OwnedDependency : IOwnedDependency { private static volatile int PreviousInstanceNumber; diff --git a/source/blazor-university-com/input/pages/forms/index.md b/source/blazor-university-com/input/pages/forms/index.md index 25a37c0..96d486f 100644 --- a/source/blazor-university-com/input/pages/forms/index.md +++ b/source/blazor-university-com/input/pages/forms/index.md @@ -18,12 +18,15 @@ The key feature to the `EditForm` is its `Model` parameter. This parameter provi Let's start by creating a class we can use with our `EditForm`. At this point a simple empty class will suffice. +```cs public class Person { } +``` Edit the standard **index.razor** page as follows: +```razor {: .line-numbers} @page "/" @@ -34,17 +37,21 @@ Edit the standard **index.razor** page as follows: { Person Person = new Person(); } +``` Line 9 creates an instance of a `Person` for our form to bind to. Line 3 creates an `EditForm` and sets its `Model` parameter to our instance. The preceding razor mark-up results in the following HTML. +```html
+``` ## Detecting form submission When the user clicks the **Submit** button in the preceding example, the `EditForm` will trigger its `OnSubmit` event. We can use this event in our code to handle any business logic. +```razor @page "/"

Status: @Status

@@ -63,6 +70,7 @@ When the user clicks the **Submit** button in the preceding example, the `EditFo // Post data to the server, etc } } +``` Form submission will be covered in more depth in the [Handling form submission](/forms/handling-form-submission/) section.