When you make use of that library you can add validation attributes to you C# form model. These validation rules are 'transformed' to client side validation rules.
It's not required to make use of the BundleConfig, it's just a mvc way to 'bundle' your scripts and stylesheets.
You can either use the Bundle or insert the scripts directly in you master view or something similiar.
The trick is mainly:
Adding validation attributes to your model
Make use of the Html helper to render your form view
Adding the unobtrusive validation library scripts
When you google on 'mvc unobtrusive' you will get a lot of examples that will you teach how to enable client side validation.
In case you have validation rules that are not covered by the model annotation attributes, you can add your custom validation rules as well. It's a little bit complex to start with, but you have to know that it is possible :)
Html.BeginUmbracoForm Validate Form Problem
How can i validate this form before submitting?
Sould do the same like this:
Submitting forms to a Surface controller is very similar to submitting forms in MVC without Umbraco.
I think you need the use of jQuery unobtrusive validation library.
https://exceptionnotfound.net/asp-net-mvc-demystified-unobtrusive-validation/
When you make use of that library you can add validation attributes to you C# form model. These validation rules are 'transformed' to client side validation rules.
In this article they start with a
BundleConfig.cs
in the folderApp_Start
Where do I put this code, if I don't have a folder
App_Start
?It's not required to make use of the BundleConfig, it's just a mvc way to 'bundle' your scripts and stylesheets.
You can either use the Bundle or insert the scripts directly in you master view or something similiar.
The trick is mainly:
When you google on 'mvc unobtrusive' you will get a lot of examples that will you teach how to enable client side validation.
In case you have validation rules that are not covered by the model annotation attributes, you can add your custom validation rules as well. It's a little bit complex to start with, but you have to know that it is possible :)
is working on a reply...