0

I have a Sitecore Form that is working fine on one SXA site. However, if try to use the same form on another site then on the click of submit button, it's redirecting to the Formbuilder page. Also, I checked the page source that default Form CSS and JS like jquery-3.4.1.min.js are not there. Any solution for it?

8
  • Have you tried troubleshooting with these steps - sitecore.stackexchange.com/a/25841/4515 ? Aug 19 '20 at 10:37
  • Also, you may need to check whether the script field has the js files - ibb.co/FYknX83 Aug 19 '20 at 10:46
  • @PaulsonMaclean The js files are there i have checked and also I have tried the above steps but still facing the same issue
    – kuldeep
    Aug 19 '20 at 10:49
  • Ok, any console errors? Aug 19 '20 at 11:01
  • If it is another site, you might have a different layout right? Are all the required steps done in this layout as well - like adding RenderFormScripts(),.. Sitecore.ExperienceForms.Mvc.Html reference to be added etc.., Aug 19 '20 at 11:03
0

Basically the default Sitecore Forms JS files should be present/referenced when you inspect or view the page source as below:

enter image description here

In your case, you said these JS files are not present. So, you need to call the @Html.RenderFormScripts() before the end of the body tag and see if the above script files are added to the page. Now you should be able to submit the form successfully without any problems.

This approach has worked for me when calling @Html.RenderFormScripts() in the head section did not add the default JS files to the page html. This maybe due to other scripts that are referenced in the beginning of the head section.

So, the layout should now look like this :

@using Sitecore.ExperienceForms.Mvc.Html
<!DOCTYPE html>
<html>
<head>
    @Html.RenderFormStyles()
    @Html.Sitecore().VisitorIdentification()
    . . . . . . .
</head>
<body>
  . . . . . 
  @Html.RenderFormScripts()
</body>
</html>
0

As you mentioned, you are using this Sitecore Form on another SXA website and on this new page, you did not see default CSS and JS. Make sure you're following all the below steps to add a form to a page:

  1. Open the Toolbox. In the Forms section, select and drag the Sitecore Form Wrapper rendering to the relevant placeholder.

enter image description here

  1. After that, drag an Mvc Form rendering to the Sitecore Forms Wrapper.

enter image description here

  1. After dragging the Mvc Form onto the page, In the Select the Associated Content dialog box, select the form that you want to display on the page and click OK. The form is now displayed on the page.

  2. In the Experience Editor, click Partial Design and click Metadata. In the SXA Toolbox, in the Forms category, drag and drop the Forms Scripts component before the closing /body tag of the page.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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