We have started migrating from WFFM to Experience Forms on Sitecore 9.0.1. I've hit an issue with jQuery reference clashes and would like to know the best way to solve it.
I started by following the instructions on this page: https://doc.sitecore.com/developers/90/sitecore-experience-management/en/add-a-form-to-a-webpage.html . I didn't create the MVC layout or MVC outer layout as we want to drop forms into existing layouts. We do not want to create and use a new layout just for forms. I did add calls to @Html.RenderFormStyles() and @Html.RenderFormScripts() to our existing layouts.
Our existing layouts include references to jQuery, jQuery.validate and jQuery.validate.unobtrusive. These scripts are included again when @Html.RenderFormScripts() is called on the page. Some of these scripts are different versions. For example, We are using jQuery 2.2.0 and Sitecore forms is using jQuery 2.1.3. I've found that script errors are thrown when these libraries are included more than once.
Some potential solutions I've investigated are:
- Changing the "Scripts" field on a form so it excludes scripts that would be duplicated. The drawback for this solution is content editors will need to make this change for every form they create
- Change the standard values for /sitecore/templates/System/Forms/Form so it excludes duplicate scripts. This doesn't seem ideal either as we'd have to sync a system template item into our solution (we use TDS)
- Instead of calling @Html.RenderFormScripts(), manually include references to the JS files we need from /sitecore%20modules/Web/ExperienceForms/scripts/ . This feels more like a workaround than a proper solution
Has anyone found a nice way to handle these duplicate jQuery references?
Thanks