Select theme:
This guide demonstrates how to use the TemplateForm component.
Name | Type | Default | Description |
---|---|---|---|
Name | string | 'templateForm' + index suffix | Unique name of the Form. |
Visible | boolean/expression | true | Is the TemplateForm visible. |
For more info about expressions please visit expressions in our documentation.
Name | Type | Default | Description |
---|---|---|---|
Submit | event | null | Submit event of the Form. Object with changed property values as event argument. |
Important!!! In order for the Submit event to trigger the TemplateForm should contain at least one Button component whose
ButtonType
property is set tosubmit
.
For more info about event actions please visit event actions in our documentation.
The TemplateForm component allows entirely custom forms. The developer can use other Radzen components (TextBox, DropDown, CheckBox, Label etc.) to create complex forms with custom layout.
||Form|TemplateForm| |Custom layout| No, components are layed out in columns and rows. | Yes, fully custom layouts are supported| |Validation|Yes, the form fields support built-in validation.| One has to use validator components - RequiredValidator, LengthValidator etc.| |Events| Submit, Cancel, LoadData, Change|Submit| |Data-bound|Yes, the form can be data-bound to a page property.| Every input component is data-bound on its own.|
The TemplateForm contains by default only a submit button which can be removed. Input components (TextBox, DropDown et. al) are used to get the user input .
Unbound TemplateForm is used when creating new data items. Then the form data is obtained via the Submit event argument. It contains the value of every input component whose Name property is set. Here is an example.
16px
to add some vertical spacing. Add two Columns in it. Set the size of the first column to 3
and the size of the second column to 9
. ProductName
. This textbox will capture the product name of a hypothetical product item. The value will be available as ProductName
in the Submit event argument.
Product Name
and Component to ProductName
. This will "link" the label with the textbox created in the previous step - when the user clicks the label the textbox will automatically focus.
Product Name is required
and Component to ProductName
. The required validator will make sure the user enters a ProductName. If she doesn't the Submit event of the form will not trigger and the Text of the validator will display.
Data-bound TemplateForm is used when updating existing data items or when one needs to specify default values. In this case the input components are data-bound - their Value property is set e.g. ${data.ProductName}
.
{ProductName: 'Product Name'}
16px
to add some vertical spacing. Add two Columns in it. Set the size of the first column to 3
and the size of the second column to 9
. ${data.ProductName}
. This will data-bind this textbox to the ProductName property of the data item. The textbox displays the initial value of data.ProductName
and updates it whenever the user types something in it. Product Name
and Component to textbox0
. This will "link" the label with the textbox created in the previous step - when the user clicks the label the textbox will automatically focus.
Product Name is required
and Component to textbox0
. The required validator will make sure the user enters a ProductName. If she doesn't the Submit event of the form will not trigger and the Text of the validator will display.
Note that in this case we are using the
data
property we created in the first step instead of the event argument.
Radzen is free to use. You can also test the premium features for 15 days.
Download NowSelect theme: