Umbraco forms - Razor email template

Hope someone could help.

I am quite new to Umbraco and using Razor to display form values within email templates. However, what I am trying to do is display certain fields in the email template, when a specific option is checked within a multiple-choice checkbox field.

For example, the options in the multiple-choice checkbox are:

  • Document
  • Spreadsheet
  • Image
  • External Web Link

I have done a few tests already, but it only seems to display one of the IF statements, even if ‘Document’ and ‘Spreadsheet’ is checked.

Below is the example piece of code I am using. I have a feeling I am not using the correct code to get the checked options, for this specific field type, but like I said, I am quite new:

What type(s) of media would you like to upload? @Model.GetValue("checkMediaType")

‘Document’ option:

@if (Model.GetValue("checkMediaType").ToString() == "Document")
{

	
Is the file being added to an existing page? @Model.GetValue("radioUploadPDFToExisting")
What is the URL of the web page? @Model.GetValue("txtPDFLinkOfPage")
In what area of the website will the file(s) go? @Model.GetValue("txtPDFFileGo")
Files attached @Model.GetValue("uploadPDF")
Please confirm that the filename is the description of the document @Model.GetValue("checkPDFConfirm")
}

Spreadsheet option:

@if (Model.GetValue("checkMediaType").ToString() == "Spreadsheet")
{

	
Is the file being added to an existing page? @Model.GetValue("radioUploadExcelToExisting")
What is the URL of the web page? @Model.GetValue("txtExcelLinkOfPage")
In what area of the website will the file(s) go? @Model.GetValue("txtExcelFileGo")
Files attached @Model.GetValue("uploadExcel")
Please confirm that the filename is the description of the document @Model.GetValue("checkExcelConfirm")
}

Hoping someone could point me in the right direction. Thank you in advance for your answers.

Jon.


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/99739-umbraco-forms-razor-email-template