Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email Template - Example-Template.cshtml FieldType.FileUpload.cshtml doesn't support multiple #691

Closed
mistyn8 opened this issue Dec 22, 2021 · 1 comment

Comments

@mistyn8
Copy link

mistyn8 commented Dec 22, 2021

uForms 9.1.1 and Umbraco 9.1.2

I know it's only a sample template but...

@switch (field.FieldType)
                                    {
                                        case "FieldType.FileUpload.cshtml":
                                            var fileUploadValue = field.GetValue();
                                            if (fileUploadValue != null && !string.IsNullOrEmpty(fileUploadValue.ToString()))
                                            {
                                                <a href="@siteDomain/@fileUploadValue" target="_blank" style="color: #00AEA2;">@fileUploadValue</a>
                                            }
                                            break;

should perhaps now be

switch (field.FieldType)
{
	case "FieldType.FileUpload.cshtml":
		foreach (var fileUploadValue in field.GetValues())
		{
			if (fileUploadValue != null && !string.IsNullOrEmpty(fileUploadValue.ToString()))
			{
				<a href="@siteDomain@fileUploadValue" target="_blank" style="color: #00AEA2;">@fileUploadValue</a>
			}
		}
		break;	

Seems to work for single or multiple (as single still gives a single item array for field.GetValues())

Also of note.. @siteDomain seems to include the trailing "/" now.. hence @siteDomain@fileUploadValue

@AndyButland
Copy link

Thanks, will amend this for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants