Support » Plugin: Calculated Fields Form » HTML content fields are not displayed in the body of sent emails.

  • Resolved Radovan

    (@radovand)


    For the display of the various fields I have studied the documentation on this page: https://cff.dwbooster.com/documentation/#special-tags and I am unable to display the content of the HTML fields in the body of sent emails.

    I set for example the folowing fields:
    – fieldname1, of type email (e.g. my@email.com);
    – fieldname2, of type text (e.g. Peter);
    – fieldname3, of type HTML content.

    The fieldname3 is for example somthing like this:
    <p>Your perception is predominantly Auditory</p>
    <p>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say. </p>

    Into the email I wrote the following special tags:
    Dear <%fieldname2%>,
    <%fieldname3%>

    Result should be:
    Dear Peter,
    Your perception is predominantly auditory.
    You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say.

    But the result is
    Dear Peter,

    I’ve tried all possible tags and none work.

    Please help.
    Thank you,
    Radovan D.

    • This topic was modified 9 months ago by Radovan.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @radovand

    Thank you very much for using our plugin.

    You can include in the notification emails and thank you pages only the submitted fields. The “HTML Content” fields are plain HTML or texts. They are not submitted to the server. So, you should include the “HTML Content” field information directly into the email content, as follows:

    Dear <%fieldname2_value%>,<br>
    <p>Your perception is predominantly Auditory</p>
    <p>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say. </p>

    Best regards.

    Thread Starter Radovan

    (@radovand)

    Thank you for your reply.
    I should mention that I have a psychological questionnaire.
    The form calculates some scores based on the answers.
    Depending on the score, the form will display the result on the page in text format.
    This text I also want to email to the person who filled in the form.

    I have set up 4 fields of type HTML, for example:
    – fieldname1 – contains Text1;
    – fieldname2 – contains Text2;
    – fieldname3 – contains Text3;
    – fieldname4 – contains Text4.

    – If the score is between X and Y , then Text1 is displayed and must also be emailed.
    – If the score is between Z and W , then Text2 is displayed and must also be emailed.
    – And so on

    How can I achieve this?

    Plugin Author codepeople

    (@codepeople)

    Hello @radovand

    Yes, you can implement it by using calculated fields.

    I’ll try to describe the process with a hypothetical example.

    Assuming you are generating the HTML content from the equation in the hidden calculated field fieldname123:

    (function(){
    var content = '';
    if(fieldname1 <= 100 ) content += "Text A";
    if(100<fieldname1 && fieldname1<=200) content += "Text B";
    if(200<fieldname1) content += "Text C";
    
    jQuery('.content-here').html(content);
    })()

    Edit the equation to return the same content:

    (function(){
    var content = '';
    if(fieldname1 <= 100 ) content += "Text A";
    if(100<fieldname1 && fieldname1<=200) content += "Text B";
    if(200<fieldname1) content += "Text C";
    
    jQuery('.content-here').html(content);
    
    return content;
    })()

    And then, you should insert the tag of the calculated field in the notification emails:

    <%fieldname123_value%>

    Best regards.

    Thread Starter Radovan

    (@radovand)

    Thank you.

    Thread Starter Radovan

    (@radovand)

    Instead of Text A, Text B and Text C, how can I send formatted text?
    For example Text A should be in the following HTML format

    <p><span style="color: #ff0000;"><strong>Your perception is predominantly Auditory</strong></span></p>
    <p><em>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say.</em></p>
    Plugin Author codepeople

    (@codepeople)

    Hello @radovand

    Yes, of course, the information you prefer.

    Best regards.

    Thread Starter Radovan

    (@radovand)

    But I don’t know how.
    I tried the following code (sorry, I don’t know much about Javascript. I started learning a week ago, but it’s going a bit slow.)

    (function () {
        var content = '';
        if (fieldname1 <= 100) content += "<p><strong>Your perception is predominantly Auditory</strong></p>
        <p>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say.</p>";
        if (100 < fieldname1 && fieldname1 <= 200) content += "Text B";
        if (200 < fieldname1) content += "Text C";
    
        jQuery('.content-here').html(content);
    
        return content;
    })()
    Thread Starter Radovan

    (@radovand)

    I think I found an intermediate solution 🙂

    (function () {
        var content = '';
        var codeBlock = '<div>' +
            '<p><strong>Your perception is predominantly Auditory</strong></p>' +
            '<p>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say.</p>' +
            +
            '</div>';
    
        if (fieldname1 <= 100) content = codeBlock;
        if (100 < fieldname1 && fieldname1 <= 200) content += "Text B";
        if (200 < fieldname1) content += "Text C";
    
        jQuery('.content-here').html(content);
    
        return content;
    })()
    Plugin Author codepeople

    (@codepeople)

    Hello @radovand

    If you want to include the text no matter the value of the fieldname1, you can implement the equation as follows:

    (function () {
        var content = '<div><p><strong>Your perception is predominantly Auditory</strong></p><p>You live in a universe of sounds, you appreciate those you meet by the sound of their voice. When you speak, you pay attention to the words you use, looking for those that sound good and match what you want to say.</p></div>';
    
        jQuery('.content-here').html(content);
        return content;
    })()

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘HTML content fields are not displayed in the body of sent emails.’ is closed to new replies.