0

I am new to Sitecore 9 and still exploring Sitecore Experience Forms.

Should a forms go to the next page if there is a validation error on a field?

In WFFM it stayed on that page, but on my Experience Form, it is getting redirected to another page

Example: (The dev_number is a required field) enter image description here

after clicking next it doesnt stay on the page enter image description here

Can we make the form stay on the page out of the box Sitecore?

0

1 Answer 1

1

This looks like validation is not working because of scripts are loaded properly from Layout. Forms gets redirected to formbuilder when it's missing the below script in MvcOuterLayout.cshtml

@using Sitecore.ExperienceForms.Mvc.Html

@Html.RenderFormStyles()
@Html.RenderFormScripts()

Couple of more things to check:

  1. Make sure you have two layouts - the outer layout that renders the script and the inner layout

For form scripts and styles to be rendered, you must use two layouts: MVC Layout.cshtml and MVC OuterLayout.cshtml. First, open the MVC Layout.cshtml file and to refer to the outer layout that you will create in the next step, add Layout = MVCOuterLayout.cshtml

Here is the documentation

  1. Make sure to publish the forms, landing page and test the page in live mode(form validation doesn't work in preview mode).
2
  • 1
    Those 2 layouts available on premise when we are installing sitecore 9 or we have to create those 2 layouts?
    – Vsn
    Aug 16, 2019 at 3:07
  • @Vsn it needs to be created. Aug 16, 2019 at 10:25

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