2

I'm using Sitecore 9, which has Sitecore Forms built-in out of the box. In the "Form Elements" tools panel on the right, there's a list of elements you can use to build the form. For example: Text, Single-line text, Multi-line text, Number, Email, etc. The Text element only allows plain text, although you can choose from a short list of html tags to wrap in it. It does not allow for rich text, such as adding anchor tags. How do you add rich text to the middle of a Sitecore Form?

1
  • If you get here and want a little more help, I followed the walkthrough. I wrote about the walkthrough and discuss some points that may save you some time when you try this yourself: linkedin.com/pulse/… Feb 26 '19 at 12:15
7

You could check the Forms Extension my colleague Bart released: https://github.com/bartverdonck/Sitecore-Forms-Extensions. It includes a "RawHtml" field that can be used to output unescaped pure html.

Or just check that code to create your own version with a custom field that suits your needs (as the raw html is fairly simple). Documentation on how to create your custom field can be found here: https://doc.sitecore.com/en/developers/90/sitecore-experience-manager/walkthrough--creating-a-custom-form-element.html

Overview of the steps (from the Walkthrough)

To build a custom form element, you need these essential steps:

  • Create a new field template (Base template is Templates/System/Forms/Fields/Field)
  • Create a new class that derives from the FieldViewModel class (for Simple field types such as an integer field or a multi-line text field ) or from the ListViewModel class (for List field types such as a drop-down list).
  • Create a razor view file that will provide the CSHTML markup that will use your view model.
  • Create the sections for the Form elements pane. Suggestion in the docs is to use Sitecore Rocks, navigate to /sitecore/client/Applications/FormsBuilder/Components/Layouts/PropertyGridForm/PageSettings/Settings and add a new item using the Form Parameters template. You can then create the new sections using the FormSection template and creating children of this new new Form Parameters item.
  • Configure the field editor parameters. For each of these new parameters you create, you'll need to set things like Styling, FormLabel, etc.
1
  • Due to a duplicate question that was recommended to come here, I found out that this is a perfect example of a "link-only answer" that breaks down (unfortunately). It looks like the link to the walkthrough is no longer valid. I have tried to fix the URL and also provide some of the instructions in the body of the answer. Sep 14 at 11:30

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.