Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stephen 26 posts 148 karma points
    Feb 09, 2023 @ 00:14
    Stephen
    0

    Show contents of read-only Text and Rich Text fields in Umbraco Forms email template

    Umbraco CMS 10.2 solution with Umbraco Forms 10.1.2.

    I have a form with several read-only fields using the Text and Rich Text field types.

    I'd like these fields to render in the email that the form generates on submission.

    My email template looks like the below, and ought to render all fields regardless of type, but the Text and Rich Text fields are excluded from the resulting email.

    @inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Forms.Core.Models.FormsHtmlModel>
    
    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    </head>
    <body>
        <h1>@Model.FormName</h1>
    
        @foreach (var field in Model.Fields)
        {
            <h4>@field.Name</h4>
            <p>@field.GetValue()</p>
        }
    </body>
    </html>
    

    Is there a way to include the contents of these fields in the template?

Please Sign in or register to post replies

Write your reply to:

Draft