A better guide to Sitecore 9 Forms

An age-old question since Sitecore 9 came out is: How do I add the damn form to a page?

I am new to Sitecore Forms like most. There is a handy guide that the good people at Sitecore came up with.

Sitecore’s official blog

Have a read, it’s pretty good but with some things missing.

I am trying to cover it here as I got it to work.

  •  I did not create the MVC layout.In the Content Editor, navigate to sitecore\Layout\, right-click Layouts, click Insert, and click MVC Layout.
  • Instead, I created a view rendering
    • Name: Form
    • Path: /Views/Layouts/MVCLayout.cshtml
  • Make sure you have the “Mvc Form” item in /sitecore/layout/Renderings/System/Forms/
  • Created a placeholder Settings
    • Name: Forms
    • Allowed Controls: “Mvc Form” from above
  • On your main website placeholder setting
    Add “Forms” as Allowed control
  • Create the MvcLayout.cshtml like below
@using Sitecore.Mvc @model RenderingModel @{ Layout = "MvcOuterLayout.cshtml"; }
@Html.Sitecore().Placeholder("form-placeholder")
  • Create MvcOuterLayout.cshtml like below
@using Sitecore.ExperienceForms.Mvc.Html @{     Layout = null; } @Html.RenderFormStyles() @Html.RenderFormScripts() @RenderBody()
  • Almost there...
  • Now you can Add a Form on the main placeholder
    and then add a form to MVC Form Placeholder
  • Final page presentation should look something like
    Screen Shot 2018-08-29 at 4.22.30 PM.png

This was the only way I was able to get the validation messages to show and the form to submit

Otherwise on submit I was being redirected to
sitename/formbuilder?fxb.FormItemId=164aee8c-4c2c-4b27-9cc4-fa9e6f7dd550&fxb.HtmlPrefix=fxb.5554a312-3d4b-48f1-9ece-3b5a211b664b

What a Mess. Eh?

~ Enjoy the little things. ~