Skip to content

Commit 8f1e7a5

Browse files
docs(Form): add form and dialog live examples (#3142)
1 parent 91daba6 commit 8f1e7a5

File tree

2 files changed

+3
-97
lines changed

2 files changed

+3
-97
lines changed

components/dialog/overview.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,7 @@ The Dialog component and its [predefined options](slug:dialog-predefined) aim to
2828

2929
>caption A basic configuration of the Telerik Dialog.
3030
31-
````RAZOR
32-
@* An example of the Dialog basic implementation. *@
33-
34-
<TelerikDialog @bind-Visible="@Visible"
35-
Title="@Title">
36-
<DialogContent>
37-
A new version of <strong>Telerik UI for Blazor</strong> is available. Would you like to download and install it now?
38-
</DialogContent>
39-
<DialogButtons>
40-
<TelerikButton OnClick="@(() => { Visible = false; })">Skip this version</TelerikButton>
41-
<TelerikButton OnClick="@(() => { Visible = false; })">Remind me later</TelerikButton>
42-
<TelerikButton OnClick="@(() => { Visible = false; })" ThemeColor="primary">Install update</TelerikButton>
43-
</DialogButtons>
44-
</TelerikDialog>
45-
46-
@code {
47-
private bool Visible { get; set; } = true;
48-
private string Title { get; set; } = "Software Update";
49-
}
50-
````
31+
<demo metaUrl="client/dialog/overview/" height="400"></demo>
5132

5233
## Predefined Dialogs
5334

components/form/overview.md

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -21,84 +21,9 @@ The <a href = "https://demos.telerik.com/blazor-ui/form/overview" target="_blank
2121
* Set the `EditContext` parameter to an [`EditContext` instance](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.forms.editcontext). The object instance from which the `EditContext` is created is important, especially when using [FormItem templates](slug:form-formitems-template) and [validation messages](slug:form-validation).
2222
1. (optional) To enable [form validation](slug:form-validation), add the `<FormValidation>` tag. Define a validator component inside, for example the [`DataAnnotationsValidator`](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.forms.dataannotationsvalidator) that is part of .NET Core.
2323

24-
<div class="skip-repl"></div>
25-
````RAZOR Model
26-
@* Provide a model to the Telerik Form *@
24+
>caption Basic Blazor Form
2725
28-
@using System.ComponentModel.DataAnnotations
29-
30-
<TelerikForm Model="@PersonModel">
31-
<FormValidation>
32-
<DataAnnotationsValidator />
33-
</FormValidation>
34-
</TelerikForm>
35-
36-
@code {
37-
private Person PersonModel { get; set; } = new Person();
38-
39-
public class Person
40-
{
41-
[Editable(false)]
42-
public int Id { get; set; }
43-
44-
[Required]
45-
[MaxLength(20, ErrorMessage = "The first name should be maximum 20 characters long")]
46-
[Display(Name = "First Name")]
47-
public string FirstName { get; set; }
48-
49-
[Required]
50-
[MaxLength(25, ErrorMessage = "The last name should be maximum 25 characters long")]
51-
[Display(Name = "Last Name")]
52-
public string LastName { get; set; }
53-
54-
[Required]
55-
[Display(Name = "Date of Birth")]
56-
public DateTime? DOB { get; set; }
57-
}
58-
}
59-
````
60-
````RAZOR EditContext
61-
@* Provide an EditContext to the TelerikForm *@
62-
63-
@using System.ComponentModel.DataAnnotations
64-
65-
<TelerikForm EditContext="@PersonEditContext">
66-
<FormValidation>
67-
<DataAnnotationsValidator />
68-
</FormValidation>
69-
</TelerikForm>
70-
71-
@code {
72-
private EditContext PersonEditContext { get; set; }
73-
74-
private Person PersonModel = new Person();
75-
76-
protected override void OnInitialized()
77-
{
78-
PersonEditContext = new EditContext(PersonModel);
79-
}
80-
81-
public class Person
82-
{
83-
[Editable(false)]
84-
public int Id { get; set; }
85-
86-
[Required]
87-
[MaxLength(20, ErrorMessage = "The first name should be maximum 20 characters long")]
88-
[Display(Name = "First Name")]
89-
public string FirstName { get; set; }
90-
91-
[Required]
92-
[MaxLength(25, ErrorMessage = "The last name should be maximum 25 characters long")]
93-
[Display(Name = "Last Name")]
94-
public string LastName { get; set; }
95-
96-
[Required]
97-
[Display(Name = "Date of Birth")]
98-
public DateTime? DOB { get; set; }
99-
}
100-
}
101-
````
26+
<demo metaUrl="client/form/overview/" height="450"></demo>
10227

10328
## Form Items
10429

0 commit comments

Comments
 (0)