• Resolved chadtesting

    (@chadtesting)


    Finally a paid user! Thanks very much.

    My question surrounds the confirmation e-mail that is sent to the user. When a user calculates my form, the output is a fieldset (or several fieldsets) with various data. The fieldsets shown are conditional to what the user inputs into the form. Other fieldsets are hidden.

    How do I tell the e-mail template to only show the fieldsets (in full HTML) that are showing, and not to show the hidden ones?

    The confirmation e-mail isn’t very useful if it can’t differentiate between shown and hidden fields.

    Thank you.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @chadtesting,

    If you are showing/hiding the fields in the form using dependencies (https://cff.dwbooster.com/documentation#dependencies) the fields that are inactive when the form is submitted are not included in the notification emails. However, the emails are not copy of forms, only the values of the input, select, and textarea fields are included in the emails.

    So, what to do to include fieldsets? In this case the fields should be inserted by separated, with some additional html tags to format the email, for example:

    <fieldset>
    <legend>First Group</legend>
    <p><%fieldname1_label%>:<b><%fieldname1_value%></b></p>
    <p><%fieldname2_label%>:<b><%fieldname2_value%></b></p>
    <p><%fieldname3_label%>:<b><%fieldname3_value%></b></p>
    </fieldset>

    but in this case, if the “First Group” fieldset is dependent and inactive when the form is submitted the email content would be weird, with the fieldset, legend, p, and b tags, but without the fields: fieldname1, fieldname2, and fieldname3, because they are dependent and were not submitted. To solve this issue you can use the pair of tags: <%fieldname#_block%><%fieldname#_endblock%>, if the field does not exists, all content between the pair of tags is ignored.

    For example, assuming the previous block should be ignored if the fieldname1 field was not submitted, it should be edited as follows:

    <%fieldname1_block%>
    <fieldset>
    <legend>First Group</legend>
    <p><%fieldname1_label%>:<b><%fieldname1_value%></b></p>
    <p><%fieldname2_label%>:<b><%fieldname2_value%></b></p>
    <p><%fieldname3_label%>:<b><%fieldname3_value%></b></p>
    </fieldset>
    <%fieldname1_endblock%>

    More information in the following link:

    https://cff.dwbooster.com/documentation#special-tags

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Thanks, I think this is a good start. I will further explain.

    I have the following setup as my outputs

    <fieldset1>
    //has the following fieldsets nested inside it
    <fieldset2>
    <fieldset3>
    <fieldset4>
    >

    AND

    <fieldset5>
    //has the following fieldsets nested inside it
    <fieldset6>
    <fieldset7>
    <fieldset8>
    >

    Whether I show <fieldset1> AND/OR <fieldset5> is conditional based on a dropdown. I may show none, either or both. Furthermore, assuming I am showing <fieldset1>, whether I show <fieldset2> or <fieldset3> or <fieldset4> is also conditional, and I may show at least one or several.

    Further, inside each NESTED fieldset (ie. <fieldset2>) there are 5 HTML fields which are also conditional based on a hidden calculated field that resides in each NESTED fieldset. For example, let’s assume the HTML fields are <fieldname1>, <fieldname2>, <fieldname3>, <fieldname4>, <fieldname5>. I will only ever show ONE of these.

    Here is an example of how I want my output e-mail to look

    Hi User,

    Here is your output based on your selections

    <fieldset1_label> (fieldset label image img src=)
    <fieldset3_label> (html modified fieldset label)
    <fieldname3> (html image img src=)

    ^ This is one example. But it could also look like this…

    Hi User,

    Here is your output based on your selections

    <fieldset1_label> (fieldset label image)
    <fieldset3_label> (fieldset label html text)
    <fieldname7> (html fieldset image)
    <fieldset4_label> (fieldset label html text)
    <fieldname12> (html fieldset image)

    <fieldset5_label> (fieldset label image)
    <fieldset6_label> (fieldset label html text)
    <fieldname20> (html fieldset image)
    <fieldset8_label> (fieldset label html text)
    <fieldname21> (html fieldset image)

    Thank you,
    Chadtesting

    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    Thread Starter chadtesting

    (@chadtesting)

    Correction above re: fieldnames

    1.) Each fieldNAME will only be shown once per nested fieldSET.

    2.) I incorrectly called my fieldname output an ‘html fieldset image’. It’s just an image linked to from the html field.

    Also consider that my finished form will have over 1,000 unique fieldsets and I will need to reproduce this logic for every e-mail sent.

    I think the issue here is that I’m not looking to output what the user inputs, rather I am looking to output the contents of several entire non-hidden fieldsets (and nested fieldsets and fields within those nested fieldsets) that is generated from the user’s selection.

    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    Thread Starter chadtesting

    (@chadtesting)

    I just need to display everything visible within a fieldset, as it appears in the output. That includes fieldset labels.

    When I try to reference a fieldset label using <%fieldname#_label%> nothing appears in the e-mail.

    Being able to show/hide based on fieldset is fine, but the way the plugin is set up, the fieldset itself has a label, so obviously that label (and all of its associated formatting) will need to be referenced when outputting e-mails.

    • This reply was modified 8 years, 1 month ago by chadtesting.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    As I said in my previous emails, the special tags: <%fieldname#%>, <%fieldname#_label%>, <%fieldname#_value%>, <%fieldname#_block%>, and , <%fieldname#_endblock%> are applied only to the editable fields: input, select and textarea, but not to the fieldsets, html, media fields or instruct for users fields. These texts should be typed directly in the emails content, and use the tags <%fieldname#_block%><%fieldname#_endblock%> to display the content between the tags if the dependent fields were submitted.

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    There is no content I want to deliver in the e-mail except the fieldset labels and an html field. That has all the content I need.

    If you’re saying I can just use

    <%fieldname1_block%>
    <%fieldname1_endblock%>

    and it will deliver everything dependent in-between, then it’s not working. The e-mail displays nothing.

    Thank you.

    Thread Starter chadtesting

    (@chadtesting)

    OK so assuming <fieldname148> is a fieldset. In order to return the fieldset label, I should be able to use the following:

    <%fieldname148_block%>
    <fieldset>
    <legend>First Group</legend>
    <p><%fieldname148_label%></p>
    </fieldset>
    <%fieldname148_endblock%>

    This should return the label of the fieldset provided it is not hidden, correct?

    Plugin Author codepeople

    (@codepeople)

    Hello,

    You cannot include the fieldset fields in the form, the special tags don’t cover the fields: fieldset, HTML, media, or Instruct. Text.

    For example, if you have a fieldset with the legend: My fieldset, and into the fieldset there is a number field called: fieldname123, if the fieldset is dependent and it is inactive, the fieldname123 is not submitted. So, you should type the fieldset’s legend directly in the email as follows:

    <%fieldname123_block%>
    <p>My Fieldset</p>
    <%fieldname1 before={{<p>}} separator={{: }} after={{</p>}}%>
    <%fieldname123_endblock%>

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Ahh OK, so Fieldset fields, html, media fields or instruct can NOT be included in the e-mail. OK, well that’s unfortunate because it means I can ONLY use input, select and textarea (like number, e-mail, dropdown).

    So then my question to you is:

    If I want to conditionally output a .jpg image into my e-mail, or rich HTML text, what is the best way to do this?

    Because currently everything I want to output in my e-mail is either in the fieldset labels, or in HTML fields.

    Keep in mind that if I can only use plain text in my e-mail, then it needs to be hidden from my public page, since text fields tend to be blocky and ugly. So they need to be shown but still hidden if you catch my meaning.

    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    • This reply was modified 8 years, 1 month ago by chadtesting.
    Thread Starter chadtesting

    (@chadtesting)

    OK so by using text fields I think I can get my intended result. In fact, I think I can use hidden fields and get an HTML output on my form and a plain text output in my e-mail.

    The problem is that you have to set up a block/endblock for every single conditional field!

    If I work that out for my form, that’s going to be around 5,000 lines of code in the e-mail form since I have a star rating from 1-5 for about 1,000 different programs.

    I would still love to know whether it’s possible to get an img in that e-mail.

    • This reply was modified 8 years, 1 month ago by chadtesting.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    If you want send images in the emails, you simply should insert an <img> tag where the src attribute is the URL to the image in your server. If the image is an “Upload Field” in the form, you can use special tags like: <%fieldname1_url%>

    About the texts into the fieldsets, you should insert them directly into the emails, and if you have fieldsets whose content are only texts, so you cannot to know if they are active or not when the form is submitted, you can insert into each fieldset a hidden field, with a value, and use this hidden field in the block tags, for example, assuming the fieldname1 field is a hidden field into the fieldset, the piece of code to include in the email would be:

    <%fieldname1_block%>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sed dictum est. Sed venenatis lacus non diam pretium tempus. Vivamus a justo eros. Suspendisse maximus auctor dui a semper. Maecenas dictum fermentum sem vel dapibus. Duis consequat vehicula lacinia. Nam in ligula ullamcorper, efficitur tortor eu, finibus lacus. Phasellus dignissim dolor non felis convallis fermentum.
    <%fieldname1_endblock%>

    Best regards.

    Thread Starter chadtesting

    (@chadtesting)

    Hi, thanks very much! I see that you can insert images into the e-mail, even inside the legend, which is nice for formatting.

    I also understand that you can do your text formatting directly inside the e-mail. Also, I figured out the ‘hidden field’ trick last night while playing around. So I am actually using it for my e-mail, while hiding it from my form.

    I hope I don’t break your plugin with the amount of <block><unblocks> I’m going to need to put into that e-mail. We’re talking thousands. For future updates, it would be nice to add the feature to be able to <block><unblock> fieldsets. It would really reduce the amount of work needed for large forms with a lot of nested conditions.

    • This reply was modified 8 years, 1 month ago by chadtesting.
    Plugin Author codepeople

    (@codepeople)

    Hello,

    It is not possible apply the tags _block and _endblock to the fieldsets, because the fieldsets are not submitted to the server side with the rest of fields in the form, it is not something that is missing in the plugin, the HTML standard only submits the information collected by the input, select, and textarea fields.

    Best regards.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Question about hiding fields in confirmation e-mail’ is closed to new replies.