We have deployed the code files to a fresh 9.3 XP instance and the Ajax form renders differently.


using (Ajax.BeginRouteForm(MvcSettings.SitecoreRouteName, null, 
new AjaxOptions { HttpMethod = "Post", OnSuccess = "fn_MemberRegistration" }, 
new { id = "form-email-verification", data_step = 1 }))

In the 8.2 instances it renders as:

<form action="/sign-up" data-ajax="true" data-ajax-method="Post" 
data-ajax-success="fn_MemberRegistration" data-step="1" id="form-email-verification" 
method="post" novalidate="novalidate">

But in 9.3, it renders as:

<form action="/sign-up" data-step="1" id="form-email-verification" method="post" 
onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" 
onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { 
insertionMode: Sys.Mvc.InsertionMode.replace, httpMethod: 'Post', 
onSuccess: Function.createDelegate(this, fn_MemberRegistration) });">

In web.config, we already have these settings:

<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<add key="ClientValidationEnabled" value="true"/>

Versions in use:
Mvc - 5.2.4
jQuery - 3.4.1.min.js

@x3mxray suggestion helped me resolve this.
The issue was with the UnobtrusiveJavaScriptEnabled setting. There was a duplicate set to false that was overwriting the previous. Removing the duplicate fixed the issue.

  • 1
    It means that somehow unobtrusive is disabled (and MicrosoftAjax is used instead). Make sure that UnobtrusiveJavaScriptEnabled is true (does not overwritten by duplicated appsetting). I just checked it on my clear 9.3 solution: Without UnobtrusiveJavaScriptEnabled=true it looks like in your case, but when I only add one appsetting UnobtrusiveJavaScriptEnabled=true - it looks good (with data-attributes), I even didn`t include any scripts, just a clear page with only one Ajax.BeginRouteForm. Check your web.config
    – x3mxray
    Feb 18 '20 at 9:14

Browse other questions tagged or ask your own question.