Preparing Your Frontend
For Umbraco Forms to work correctly, you need to include some client dependencies.
Client-Side Validation
Umbraco Forms ships with client-side form validation features provided by the ASP.NET Client Validation library.
You can use the following Razor helper to output script tags containing the dependencies. To access this method you will need a reference to Umbraco.Forms.Web
:
Alternatively, you can add the dependencies to the body tag:
All dependencies originate from your Umbraco Forms installation, which means that no external references are needed.
Validation Using jQuery
If you want to use jQuery as your validation framework for Umbraco Forms, you can manually add the following client dependencies:
jQuery
(JavaScript library)jQuery validate
(jQuery plugin that provides client-side Form validation)jQuery validate unobtrusive
(Add-on to jQuery Validation that provides unobtrusive validation via data-* attributes)
You should remove any calls to @Html.RenderUmbracoFormDependencies(Url)
.
The easiest way to add the dependencies is to fetch them from a CDN. There are various CDN services you can use:
For example: Microsoft CDN.
Other CDN services you might want to look at are https://www.jsdelivr.com/ and https://cdnjs.com/about, which may offer better performance and more reliable service.
To add the three client dependencies, see the examples below:
Example within head
tags.
Example within body
tags.
When adding the script to the bottom of the page, you will also need to render the scripts. For more information, see Rendering Forms Scripts article.
Last updated