1

I am getting an error below while submitting the Sitecore forms in the Sitecore 10.3 version.

Uncaught TypeError: Cannot read properties of undefined (reading 'unobtrusive')

Does anyone ever encounter this issue? any help is appreciated.

4

2 Answers 2

0

Incase you are not using a custom Sitecore Form submit action and if you suspect jQuery conflict is happening somewhere, its worth to have a look at your scripts loading from Themes folder(If you are using SXA)

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

Hope it helps!

0

It’s all related to Validation while submitting the form. Here are the points to check to narrow down the issue.

  1. If you have form fields set it to mandatory, change it to optional, and see if that makes the submission successful. If so, one of the field validation is causing trouble.
  2. It happens for custom form control quite often, where you need to add the validation to the razor view file and make sure you have this attribute – GenerateUnobtrusiveValidationAttributes.
<label for="@Html.IdFor(m => Model.Value)" class="@Model.LabelCssClass">@Html.DisplayTextFor(t => Model.Title)</label>
<select data-trigger class="@Model.CssClass @Model.Name" name="@Html.NameFor(m => Model.Value)" id="@Html.IdFor(m => Model.Value)" data-sc-tracking="@Model.IsTrackingEnabled" data-sc-field-name="@Model.Name" @Html.GenerateUnobtrusiveValidationAttributes(m => m.Value)>
</select>
@Html.ValidationMessageFor(m => Model.Value)
  1. If it's custom control then compare your custom control razor file to any one of the inbuilt form controls (wwwroot\[iis-site-folder]\Views\FormBuilder\FieldTemplates) like below and if you see any difference on attributes, add it out.
  2. Finally a simple check: make sure to publish all the forms and view the landing page in live mode (not in preview mode).

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.