Q:

Sitecore Forms on Submit: Cannot read property 'unobtrusive' of undefined

When submitting a Sitecore Forms form, we get the following Javascript exception in our console:
Uncaught TypeError: Cannot read property 'unobtrusive' of undefined
  at HTMLFormElement.eval (eval at d (jquery.unobtrusive-ajax.min.js:1), <anonymous>:3:13)
  at Object.success (jquery.unobtrusive-ajax.min.js:1)
  at l (jquery-2.1.3.min.js:14)
  at Object.fireWith [as resolveWith] (jquery-2.1.3.min.js:14)
  at p (jquery-2.1.3.min.js:14)
  at XMLHttpRequest.<anonymous> (jquery-2.1.3.min.js:14)

How can this be fixed?

A:

This can happen for multiple reasons:
A) Missing attributes on a custom field 
Solution: Make sure that the @Html.GenerateUnobtrusiveValidationAttributes(m => m.Value) attribute is present on all of your fields.
See http://madhuanbalagan.com/sitecore-9-forms-uncaught-typeerror-cannot-read-property-unobtrusive-of-undefined for details
B) jQuery is being used in noConflict mode
On successful submit, Sitecore Forms executes some JavaScript that directly targets $.validator.unobtrusive
which is not defined. Instead it should be jQuery.validator.unobtrusive.
This can be fixed with a Forms.RenderForm processor:
Config:
<pipelines>
<forms.renderForm>

    <processor type="MyProject.Pipelines.Forms.RenderForm.FixJqueryReference, MyProject" resolve="true" 
               patch:after="processor[@type='Sitecore.ExperienceForms.Mvc.Pipelines.RenderForm.InitializeAjaxOptions, Sitecore.ExperienceForms.Mvc']"/>
  </forms.renderForm>
</pipelines>

Code:
public class FixJqueryReference : MvcPipelineProcessor<RenderFormEventArgs>
{
    public override void Process(RenderFormEventArgs args)
    {
        var attributes = args.Attributes["data-ajax-success"] as string;
        if (string.IsNullOrEmpty(attributes))
        {
            return;
        }

        args.Attributes["data-ajax-success"] = attributes.Replace("$.", "jQuery.");
    }
}

