Setting up all sorts of forms is now easy with the new Telerik UI for ASP.NET Core Form component. As is routine, it gives you absolute freedom in how you want to build your next application’s registration page or contact form.
To specify the fields your form consists of, it is enough to supplement a list of field descriptors which tell the component how each field should be rendered. What’s the value type (password, address or plain old text?) What sort of validation does it have?
The Form can be oriented both horizontally and vertically which makes it really easy to fit it anywhere on the page. It can be rendered as a grid if you want to have separate columns. Should it have different columns? Or would you rather have it decide on its own what’s the best presentation? Take your pick!
When you first add a form to your page, you will see two buttons by default – “Clear” and “Submit” whose exact function you can probably guess. In many cases you would want to change them to say something else like “Agree & Continue” in your sign-up form when displaying the application’s license agreement – and the Form will let you customize that as well as other elements.
The Form can be validated in its entirety but any field the form contains can also be validated on its own. You need to implement and pass a callback for each validation you need to be executed and the control will make sure to call them when the time is right. Furthermore, you can configure whether validation is run when the element loses focus or at another time and how should the error message look like.
Data can be bound to the Form component. This will both make sure set you the values of your model directly with what the user entered but also save you time. When the form is provided with a data model, it will automatically generate an input field for every property in your model, depending on its type!