Search code examples
sitecoresitecore8web-forms-for-marketers

Sitecore Web Forms for Marketers, add info to the display-section-legend class


We are on Sitecore 8 using Web Forms for Marketers.

I am trying to identify how to add information to the "display-section-info" class item in a sitecore WFFM form. Looking @ The generated code I see an element (display-section-info class) after the Field Legend, and before the starts of our fields. I would like to put some basic information regarding the fields in this element (below has text "THIS IS WHERE I WOULD LIKE TO ADD TEXT").

Here is the source from "View Source" on the browser. Through developer tools I plugged in some info and that is exactly where I want it to go.

 <fieldset class="display-section-fieldset">
        <legend class="display-section-legend">1. OUTSIDE INTEREST:</legend>
            <p class="display-section-info">THIS IS WHERE I WOULD LIKE TO ADD TEXT</p>

        <div class="display-section-content">

            <div class=" field-border">

        <span class=" field-title">
                <span class=" field-required">*</span>
            In the field below, list exceptions 

        </span>

Update1: per Jammycans response I added a few parameters to the section but did not seem to display. items have been published, I also confirmed on the prod DB.

Content Editor enter image description here

Results:
enter image description here

Thanks in advance


Solution

  • There is no field in the Form Editor to set this information, you can set it directly on the section item itself.

    In the Content Editor, expand the form and select the Form Section item. On the section item in the Parameters field set the information field text you need:

    <Information>THIS IS WHERE I WOULD LIKE TO ADD TEXT</Information>
    

    You can use the Localized Parameters field if you need to translate the text.

    EDIT:

    There is a bug in the logic on the default WFFM section view, located in \Views\Form\EditorTemplates\SectionModel.cshtml (for Sitecore 8 update 5 and earlier). On lines 18-21, the code reads:

    @if (string.IsNullOrEmpty(Model.Information))
    {
        <p class="@Model.CssClass display-section-info">@Html.Sitecore().Field("Information", Model.InnerItem)</p>
    }
    

    The first line here should read:

    @if (!string.IsNullOrEmpty(Model.Information))
    

    Note the "!". That explains why you were seeing the markup previously, even though the parameter was not set. You need to update the code in the view in order to fix it.