0

I need to add a Consent check box with some label content.

Example label content: By checking this box you are consenting abc abc in our <a href="https://www.abc.com/privacy-policy">Privacy Policy</a>.

If I try to add the above data in the Form label, the anchor tag is not converted to link and stays as text. How do I get the label to render it as HTML?

1
2

I recommend creating your custom Form element where you will add Richtext Field in the template. Call it "Checkbox with Richtext" or "Checkbox with links" or "Advanced Checkbox" or anything you come up with :) Then you will create Model class and Razor view file where input type checkbox will be rendered with your Richtext field text. This should be editable and also supported.

Follow Sitecore official documentation for more detailed steps -> https://doc.sitecore.net/sitecore_experience_platform/digital_marketing/sitecore_forms/setting_up_and_configuring/walkthrough_creating_a_custom_form_element

I haven't tested this by myself so I don't know whether Richtext fields are supported this way in Sitecore Forms. Please try and let all others know here.

1
  • We've done something very much like this this with WFFM on Sitecore 8.2, though there all form fields share the same template so we had to extend it. We then added a fallback so that the rich text overrode the standard title field if it existed. Some further tweaks were needed for the Experience editor, but we didn't go as far as extending the wffm form designer. Jan 4 '19 at 13:17
1

Change

@Html.DisplayTextFor(t => Model.Title)

to

@Html.Raw(Model.Title)

under Checkbox.cshtml under your Website\Views\FormBuilder\FieldTemplates. It will render all the html tag and your anchor tag will work.

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.