Forms 6.0.2 on CMS 13: form elements created as inline blocks are silently not rendered
Creating inline elements in an Optimizely form (v6.0.2) on CMS 13 does not render the inline element. There is an option to add this as inline, and to convert to inline, but once this is done the element does not show.
This should be possible, and if not possible, there should not be an option to add these as inline.
Description from support ticket confirming this is an issue:
Product and versions
- EPiServer.Forms 6.0.2 (EPiServer.Forms.Core / EPiServer.Forms.UI 6.0.2)
- EPiServer.CMS 13.6.0, EPiServer.Commerce 15.5.0, .NET 10
Summary
A form whose elements were added to the "Form elements" area as inline blocks renders with none of those elements on the site. Only elements that are shared blocks render. No error is shown to the editor or written to the log, and the form can be saved and published in this state.
Steps to reproduce
1. In the CMS 13 editor, create a new form (Form container).
2. Add any elements such that thy appear in the Form elements list without the
"SHARED" label.
3. Add one more element as a shared block (in our case a custom turnstile element). It
appears with the "SHARED" label.
4. Publish the form, place it on a page and publish the page.
5. View the page as a visitor.
Expected
All form elements render and can be submitted.
Actual
The form's title and description render, followed only by the shared element. Every inline element is missing: no inputs, no submit button. In our test form
that is 38 of 39 elements. A second form built only from shared elements renders correctly on the same page type.
What we found
Looking at EPiServer.Forms.Core 6.0.2,
FormBusinessService.GetFormElementBlocks builds the form's elements by loading
each ContentAreaItem of ElementsArea through its ContentLink:
item.ContentLink.GetContent(...) is ElementBlockBase
An inline block's ContentAreaItem carries its data in InlineBlock and has no
ContentLink, so it loads as null and is skipped. Element names
(_field{content id}), validation, dependencies and submission storage also
all key off the element's content ID, which an inline block does not have.
So Forms 6.0.2 does not appear to support inline blocks as form elements, but
the CMS 13 editor lets an editor create them in the Form elements area.