umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
29 stars 0 forks source link

Documentation doesn't mention the use of aspnet-validation package... #1234

Closed mistyn8 closed 2 months ago

mistyn8 commented 3 months ago

https://docs.umbraco.com/umbraco-forms/developer/prepping-frontend

As a long term user of forms where we had to use jquery/validation/unobtrusivevalidation in the past the docs still read as though this was required.

In fact if you do want to use jquery then you have to not include @Html.RenderUmbracoFormDependencies(url) as this includes the aspnet-validation.js file and the umbraco-forms.js checks for if (void 0 !== window.aspnetValidation) { } else { // see if we have jquery setup instead}

There is another issue in that if the user has already decided to use aspnet-validation.js for custom non umbraco forms then depending on versions.. (or using the original https://github.com/ryanelian/aspnet-validation for instance) results in a javascript error a.ValidateForm() doesn't exist.) Possibly edge case...

Indeed if the user wanted to use smidge to bundle aspnet-validation scripts into a predefined bundle, I'm not sure we have the same facility as used to be the case with cdf in umbraco 8 having support for forms dependancies?

Could the documentation be extended to highlight that aspnet-validation is being used, and how to defer properly to jquery if required, or indeed adding dependencies to an existing sitewide bundle?

AndyButland commented 2 months ago

Thanks for the suggestion and raising these issues @mistyn8. I've created a PR for the docs to address the documentation points you have noted. Please feel free to review and comment on that if you feel there's anything that can be clarified further.