Updating email template (Partial Views/forms/Emails) to show caption from fieldset
Hi,
I am using Umbraco 7 and have copied the Example-Template and adjusted it.
We would like to display the fields under the headings of their fieldset captions.
I would appreciate any help. The inner foreach works but the outer foreach is not producing an h3 caption.
We would also like to have a line break after each return the person completing the form makes when filling in a textArea field.
Thank you for any advice (Not sure if 'Model.Fieldsets' is correct )
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #303033; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
@foreach (var fieldset in Model.Fieldsets){
if (!string.IsNullOrWhiteSpace(fieldset.Caption)) {
<h3 style="font-weight: 700; margin: 0; color: #000000;">@fieldset.Caption</h3>
}
@foreach (var field in Model.Fields)
{
var fieldVal = field.GetValue();
if(!fieldVal.ToString().Contains("False") && fieldVal!=""){
<h4 style="font-weight: 700; margin: 0; color: #000000;">@field.Name</h4>
switch (field.FieldType)
{
case "FieldType.FileUpload.cshtml":
<p style="margin-top: 0;"><a href="@siteDomain/@field.GetValue()" target="_blank" style="color: #00AEA2;">@field.GetValue()</a></p>
break;
case "FieldType.DatePicker.cshtml":
<p style="margin-top: 0;">@(Convert.ToDateTime(field.GetValue()).ToString("f"))</p>
break;
case "FieldType.CheckboxList.cshtml":
<p style="margin-top: 0;">
@foreach (var color in field.GetValues())
{
@color<br/>
}
</p>
break;
default:
<p style="margin-top: 0;">@field.GetValue()</p>
break;
}
}
}
<hr/>
}
</td>
It's ok, found the issue - it won't call the fieldset because the FormsHTMLModel doesn't collect or enable this info to be passed to the email template.
Updating email template (Partial Views/forms/Emails) to show caption from fieldset
Hi, I am using Umbraco 7 and have copied the Example-Template and adjusted it. We would like to display the fields under the headings of their fieldset captions.
I would appreciate any help. The inner foreach works but the outer foreach is not producing an h3 caption.
We would also like to have a line break after each return the person completing the form makes when filling in a textArea field.
Thank you for any advice (Not sure if 'Model.Fieldsets' is correct )
It's ok, found the issue - it won't call the fieldset because the FormsHTMLModel doesn't collect or enable this info to be passed to the email template.
The code that needed adding for a linebreak was
Hope someone else finds this useful Thank you
is working on a reply...