Skip to content

Commit 975a7fa

Browse files
[4.1] docs(form): add article for combination of autogenerated and manually… (#1354)
* docs(form): add article for combination of autogenerated and manually defined fields * docs(form): fixes as per comments
1 parent dc924e3 commit 975a7fa

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

components/form/formitems/overview.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ You can customize the [default editors]({%slug form-overview%}#automatic-generat
1515
In this article:
1616

1717
* [Basics](#basics)
18-
* [Example - Customize the appearance of the editors in the Form](#customize-the-appearance-of-the-editors-in-the-form)
18+
* [Example—Customize the appearance of the editors in the Form](#customize-the-appearance-of-the-editors-in-the-form)
19+
* [Add Form Fields to Autogenerated Ones](#add-form-fields-to-autogenerated-ones)
1920

2021
## Basics
2122

@@ -75,12 +76,40 @@ The `FormItem` tag exposes the following parameters which you can use to customi
7576
}
7677
````
7778

78-
>caption The result from the code snippet above
79+
## Add Form Fields to Autogenerated Ones
7980

80-
![FormItem example](images/formitem-example.png)
81+
To combine manually defined with autogenerated fields, use an instance of the `FormAutoGeneratedItems` tag inside the `FormItems` collection.
8182

83+
>caption Basic configuration of the Hybrid Form.
8284
85+
````CSHTML
86+
@* Use the FormAutoGeneratedItems tag inside the FormItems to control the autogenerated fields position. *@
87+
88+
@using System.ComponentModel.DataAnnotations
89+
90+
<TelerikForm Model="@person">
91+
<FormValidation>
92+
<DataAnnotationsValidator></DataAnnotationsValidator>
93+
</FormValidation>
94+
<FormItems>
95+
<FormItem Field="@nameof(Person.Id)" Enabled="false" LabelText="Id"></FormItem>
96+
<FormItem Field="@nameof(Person.FirstName)" LabelText="First name" Hint="Enter your first name"></FormItem>
97+
<FormAutoGeneratedItems></FormAutoGeneratedItems>
98+
</FormItems>
99+
</TelerikForm>
83100
101+
@code {
102+
public Person person = new Person();
103+
104+
public class Person
105+
{
106+
public int Id { get; set; } = 10;
107+
public string FirstName { get; set; } = "John";
108+
public string LastName { get; set; } = "Doe";
109+
public DateTime DOB { get; set; } = DateTime.Today.AddYears(-20);
110+
}
111+
}
112+
````
84113

85114
## See Also
86115

components/form/overview.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ To use the Form component with a model:
104104

105105
## Form Items
106106

107-
There are two ways to generate fields in the Blazor Form:
107+
There are three ways to generate fields in the Blazor Form:
108108

109-
* By manually defining [FormItems]({%slug form-formitems%}).
110-
* Allowing the Form to [automatically generate them](#automatic-generation-of-field).
109+
* [Define FormItems]({%slug form-formitems%}) manually.
110+
* Allow the [Form to automatically generate items](#automatic-generation-of-field).
111+
* [Combine the above two options]({%slug form-formitems%}#add-form-fields-to-autogenerated-ones).
111112

112113
The Form Items allow you customize the [default editors](#automatic-generation-of-fields). [See the [FormItems article for more information...]({%slug form-formitems%}).
113114

0 commit comments

Comments
 (0)