Skip to content

Commit 5a15f9e

Browse files
Document the validation tools (#241)
* chore(validation): inital commit * chore(validator-helpers): overview article and new idea of articles * chore(validation-helpers):overview article improvements * chore(validation-tools): fix slugs; rename helpers to tools * chore(validation-tools): messages article * chore(validation-tools): summary article * chore(validation-tools): fix slugs * chore(validation-tools): overview fixes * chore(validation-tools): add the tooltip article * chore(validation-tools): minor improvements * chore(validation-tools): add the validation tools to the config file * chore(kb): update the validation error in tooltip kb article * chore(form): notes on validation * chore(validators): minor tweaks * chore(validators): edit form example for summary * chore(validators): minor fixes on screenshots, example for edit form * chore(validators): tooltip tweaks; editform example * chore(kb): minor tweaks on validationmessage as tooltip kb Co-authored-by: Marin Bratanov <[email protected]>
1 parent def46d2 commit 5a15f9e

22 files changed

+946
-12
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ navigation:
333333
title: "TreeMap"
334334
"*upload":
335335
title: "Upload"
336+
"*validation":
337+
title: "Validation Tools"
336338
"*validator":
337339
title: "Validator"
338340
"*window":
@@ -448,6 +450,7 @@ intro_columns:
448450
"Notification": "notification-overview"
449451
"Splitter": "splitter-overview"
450452
"Form": "form-overview"
453+
"Validation Tools": "validation-tools-overview"
451454
-
452455
title: "Scheduling"
453456
items:

components/form/formitems/template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ published: True
88
position: 5
99
---
1010

11-
# FormItem Template
11+
# FormItem Template - Custom Editors
1212

1313
You can provide your own custom editors instead of the [default editors the form can generate]({%slug form-overview%}#automatic-generation-of-fields). To do that, use the the `Template` of the [FormItem]({%slug form-formitems%}).
1414

15-
When the Template is used, the built-in validation messages from the Form will not be rendered. Instead you can use the [Telerik Validation tools]({%slug validation-tools-overview%}) to provide validation messages, or any other suitable component.
15+
When the Template is used, the built-in validation messages from the Form will not be rendered. Instead you can use the [Telerik Validation tools]({%slug validation-tools-overview%}) to provide validation messages, or any other suitable component such as the `ValidationMessage` that comes with the framework.
1616

1717
In this article you can find the following examples:
1818

components/form/overview.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ The Form for Blazor allows you to generate a form based on your model and to man
1414

1515
#### This article is separated in the following sections:
1616

17+
1718
* [Use the Telerik Form for Blazor with a model](#use-the-telerik-form-for-blazor-with-a-model)
1819
* [Use the Telerik Form for Blazor with an EditContext](#use-the-telerik-form-for-blazor-with-an-editcontext)
20+
* [Component Reference](#component-reference)
1921
* [Automatic Generation of fields](#automatic-generation-of-fields)
2022
* [Data Annotation Attributes](#data-annotation-attributes)
2123
* [Features](#features)
2224

2325

24-
## Use the Telerik Form for Blazor with a model
26+
## Use the Telerik Form for Blazor With a Model
2527

2628
To use the Form component with a model:
2729

@@ -66,7 +68,7 @@ To use the Form component with a model:
6668
6769
![Form Basic Example](images/form-basic-example.png)
6870

69-
## Use the Telerik Form for Blazor with an EditContext
71+
## Use the Telerik Form for Blazor With an EditContext
7072

7173
The Telerik Form for Blazor can utilize the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.forms.editcontext?view=aspnetcore-5.0">EditContext class</a>. You can use the events and methods provided by the EditContext to provide custom business logic.
7274

@@ -121,7 +123,9 @@ To use the Form component with an EditContext:
121123
![Form Basic Example](images/form-basic-example.png)
122124

123125

124-
#### Component Reference
126+
## Component Reference
127+
128+
The component reference provides you with access to the `EditContext` object that the form will generate when you pass a `Model` to it. It could be useful to, for example, re-attach validation when you change the model - `FormReference.EditContext.AddDataAnnotationsValidation()`.
125129

126130
>caption Get a reference to the Telerik Form for Blazor
127131

components/form/validation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ To enable validation in the Telerik Form for Blazor add the `<FormValidation>` t
5858
}
5959
````
6060

61+
When you provide an `EditContext` to the form, you cold use its `AddDataAnnotationsValidation()` method to add the data annotation validation to the form, instead of using the markup. This can be useful when you will be changing the model the form is bound to at runtime, for example, when you [add a reset button]({%slug form-formitems-buttons%}#how-to-add-a-reset-clear-button-to-the-form). Alternatively, you could call this method to re-attach validation on the `Model` you pass when you change it by using the [reference to the Form component]({%slug form-overview%}#component-reference) - `TheFormReference.EditContext.AddDataAnnotationsValidation()`.
62+
6163
## Validation Message Type
6264

6365
With the `ValidationMessageType` parameter of the Telerik Form for Blazor you can customize the way the validation messages are presented to the user. This setting accepts a member of the `FormValidationMessageType` enum:
6.85 KB
Loading
9.79 KB
Loading
7.21 KB
Loading
13.5 KB
Loading
6.86 KB
Loading
8.81 KB
Loading

0 commit comments

Comments
 (0)