Posted on 11/02/2020 17:59:02
The template is a copy of your DefaultMailReceipt.cshtml from DW 9.7.1 so I omitted the css. it provides nothing now and makes the code much larger. further, there are some minor changes, but for labels and text-colors and nothing that could make or break the link.
I've marked the relevant code with orange. and even though the condition of being a file is met, the loop never reaches this point and I really don't understand why.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Dynamicweb Forms Mail template</title>
</style>
</head>
@{
string submitDate = DateTime.Now.ToString("MM/dd/yyyy H:mm"); this line I had to change due to some assembly references missing, and since Submitdate equals now, this would provide the same result (however, this is not a part of this question, just to inform you that this line is changed compared to Dw defaultMailReceipt.cshtml
string subject = GetString("Submit.ReceiptSubject");
string text = GetString("Submit.ReceiptText");
string receiptUrl = GetString("Submit.ReceiptUrl");
string requestUrl = "http://" + GetGlobalValue("Global:Request.Host");
string templateBaseUrl = GetString("Template:BaseUrl");
string emailFieldName = GetString("Submit.EmailFieldValue");
if (!String.IsNullOrEmpty(emailFieldName))
{
emailFieldName = "<br />av " + emailFieldName;
}
}
<body bgcolor="#e5e5e5">
<!-- Start of seperator -->
<table width="100%" bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="seperator">
<tbody>
<tr>
<td>
<table width="600" align="center" cellspacing="0" cellpadding="0" border="0" class="devicewidth">
<tbody>
<tr>
<td align="center" height="15" style="font-size:1px; line-height:1px;"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of seperator -->
<!-- Start of preheader -->
<table width="100%" bgcolor="#E5E5E5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="preheader">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
<table width="580" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%" height="2" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"></td>
</tr>
<tr>
<table width="420" align="left" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font-family: Helvetica, arial, sans-serif; font-size: 12px; color: #b7b7b7; text-align:left; line-height: 18px;" st-content="fulltext-content">
Innsendt den @submitDate @emailFieldName
</td>
</tr>
</tbody>
</table>
<table width="150" align="right" border="0" cellpadding="0" cellspacing="0" class="devicewidth">
<tbody>
<tr>
<td align="right" style="font-family: Helvetica, arial, sans-serif; font-size: 12px;color: #b7b7b7; text-align:right; line-height: 18px;" st-content="viewonline" class="mobile-hide">
<a href="@requestUrl@receiptUrl" style="text-decoration: none; color: #b7b7b7">@Translate("EmailViewInBrowser", "Se i nettleser")</a>
</td>
</tr>
</tbody>
</table>
</tr>
<tr>
<td width="100%" height="5" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"></td>
</tr>
<tr>
<td>
<table width="320" align="left" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font-family: Helvetica, arial, sans-serif; font-size: 12px; color: #b7b7b7; text-align:left; line-height: 18px;" st-content="fulltext-content"></td>
</tr>
</tbody>
</table>
<table width="250" align="right" border="0" cellpadding="0" cellspacing="0" class="devicewidth">
<tbody>
<tr>
<td width="30" height="30" align="right">
<a target="_blank" href="@requestUrl">
<img src="@requestUrl/a-logofile.png" alt="" border="0" style="display:block; border:none; outline:none; text-decoration:none;" />
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of preheader -->
<!-- Start of header -->
<table width="100%" bgcolor="#E5E5E5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="header">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<!-- Spacing -->
<tr>
<td height="30" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td>
</tr>
<!-- Spacing -->
<tr>
<td>
<!-- logo -->
<table width="560" align="center" border="0" cellpadding="0" cellspacing="0" class="devicewidth">
<tbody>
<tr>
<td style="font-family: Calibri Light, Helvetica, arial, sans-serif; font-size: 45px;font-weight:100; color: #BA0020; text-align:center; line-height: 45px;" st-title="fulltext-heading">
@subject
</td>
</tr>
</tbody>
</table>
<!-- end of logo -->
</td>
</tr>
<!-- Spacing -->
<tr>
<td height="30" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td>
</tr>
<!-- Spacing -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of Header -->
<!-- Start Full Text -->
<table width="100%" bgcolor="#E5E5E5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="full-text">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<!-- Spacing -->
<tr>
<td height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td>
</tr>
<!-- Spacing -->
<tr>
<td>
<table width="560" align="center" cellpadding="0" cellspacing="0" border="0" class="devicewidthinner">
<tbody>
@if (!String.IsNullOrEmpty(text))
{
<tr>
<td style="font-family: Helvetica, arial, sans-serif; font-size: 16px; color: #333333; text-align:left; line-height: 24px;" st-content="fulltext-content">
@text
</td>
</tr>
}
<!-- End of content -->
</tbody>
</table>
</td>
</tr>
<!-- Spacing -->
<tr>
<td height="20" style="font-size:1px; line-height:1px; mso-line-height-rule: exactly;"> </td>
</tr>
<!-- Spacing -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- end of full text -->
<!-- Start of seperator -->
<table width="100%" bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="seperator">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" align="center" cellspacing="0" cellpadding="0" border="0" class="devicewidth">
<tbody>
<tr>
<td align="center" height="30" style="font-size:1px; line-height:1px;"> </td>
</tr>
<tr>
<td width="550" align="center" height="1" bgcolor="#d1d1d1" style="font-size:1px; line-height:1px;"> </td>
</tr>
<tr>
<td align="center" height="30" style="font-size:1px; line-height:1px;"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of seperator -->
<!-- form values -->
<table width="100%" bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td>
<!-- col 1 -->
<table width="560" align="center" border="0" cellpadding="0" cellspacing="0" class="devicewidth">
<tbody>
@foreach (LoopItem field in GetLoop("FieldValues"))
{
int fieldId = field.GetInteger("Field.ID");
string fieldHtmlId = field.GetString("Field.HtmlId");
string fieldName = field.GetString("Field.Name");
string fieldControl = field.GetString("Field.Control");
string fieldDescription = field.GetString("Field.Description");
bool fieldIsButton = field.GetBoolean("Field.IsButton");
string submitValue = field.GetString("SubmitData.Value");
string submitOptionText = field.GetString("SubmitData.Value.OptionText");
bool fieldIsFile = field.GetString("Field.Type") == "File" ? true : false;
if (!fieldIsButton)
{
<tr>
<td width="200" align="right" valign="top" class="devicewidth" style="font-family: Helvetica, arial, sans-serif; font-size: 14px; color: #323A45; text-align:right; line-height: 1.5em;padding-right:20px;" st-title="3col-title1">
</td>
<td width="360" align="left" valign="top" class="devicewidth" style="font-family: Helvetica, arial, sans-serif; font-size: 14px; color: #333333; text-align:left; line-height: 1.5em;" st-title="3col-title1">
@if (!string.IsNullOrEmpty(submitOptionText))
{
if (fieldIsFile)
{
<a href="@submitOptionText">@Translate("Filvedlegg")</a>
}
else
{
@submitOptionText
}
}
else
{
@submitValue.Replace(Environment.NewLine, "<br>")
}
</td>
</tr>
<tr>
<td align="center" height="10" style="font-size:1px; line-height:1px;"> </td>
</tr>
}
}
</tbody>
</table>
</td>
<!-- spacing -->
<!-- end of spacing -->
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- end form values -->
<!-- Start of seperator -->
<table width="100%" bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="seperator">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" align="center" cellspacing="0" cellpadding="0" border="0" class="devicewidth">
<tbody>
<tr>
<td align="center" height="30" style="font-size:1px; line-height:1px;"> </td>
</tr>
<tr>
<td width="550" align="center" height="1" bgcolor="#d1d1d1" style="font-size:1px; line-height:1px;"> </td>
</tr>
<tr>
<td align="center" height="30" style="font-size:1px; line-height:1px;"> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of seperator -->
<!-- Start of Postfooter -->
<table width="100%" bgcolor="#e5e5e5" cellpadding="0" cellspacing="0" border="0" id="backgroundTable" st-sortable="postfooter">
<tbody>
<tr>
<td>
<table width="600" bgcolor="#ffffff" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td width="100%">
<table width="600" cellpadding="0" cellspacing="0" border="0" align="center" class="devicewidth">
<tbody>
<tr>
<td align="center" valign="middle" style="font-family: Helvetica, arial, sans-serif; font-size: 14px;color: #999999" st-content="postfooter">
<a href="https://b2b.tysse.no" style="text-decoration: none; color: #BA0020">Tysse Mekaniske Verksted AS</a>
</td>
</tr>
<!-- Spacing -->
<tr>
<td width="100%" height="20"></td>
</tr>
<!-- Spacing -->
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- End of postfooter -->
</body>
</html>