The Telerik UI for ASP.NET MVC Form component is a container for all the input elements a user is required to fill when sending data from your web page. The Form is more than the sum of it parts as it adds more features than simply being a container for all input elements the user is required to fill. Features like easy configuration of the fields in the form, complete customization of how the form is laid out and with support to validate elements on their own or all-together.
The Form component can be bound to data, so it directly updates the model. If you provide your model, you are free to omit the explicit list of fields – the control will automatically generate a field for every property in your model which will match the property’s type! Or, you can do both and use the field configuration to override some of the auto-generated input elements.
To make building custom forms as easy as possible, specifying the items that your form is comprised of is made simple. All you need to do is provide the information for each field that should be rendered. Is this a number, password or a date? Should it be validated? What’s the label that needs to be printed next to the input?
The Form can be laid out both horizontally and vertically to give you greater flexibility when deciding the most appropriate place to put it in your web page. Should it have different columns? Or would you rather have it decide on its own what’s the best presentation?
The Form component has a built-in grouping functionality allowing you to create more intuitive forms by dividing fields into logically grouped sections, such as Personal Information, Shipping Address, Payment Details etc.
By default, forms will display two buttons – “Clear” and “Submit” which will do exactly what the label says. You can override the default to display as many buttons as you need and have them say anything. For example, you might want to have “Agree & Continue” in a form displaying the application’s license agreement.
The form can be fully validated. You are free to provide your own callbacks to validate the entire form and any of the fields in it separately. The validation itself can be further configured with things like when to run (e.g. when the element loses focus?) and how should the error message look.