Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • naitsirhc 15 posts 117 karma points
    Feb 06, 2019 @ 10:08
    naitsirhc
    0

    Umbraco Forms - send email with only filled out fields.

    Hi

    I am using Umbraco Forms and wonder if it is possible to send an email with a copy of a form, with only the fields that are filled out.

    I totally new to Umbraco and C# in general. So if any could point me in the right direction.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Feb 06, 2019 @ 10:14
    Nik
    100

    Hi Christian,

    In theory yes I would have thought it would be.

    By default the e-mail that is sent will be using the Example-Template.cshtml file that is located in the folder /views/partials/forms/emails/ (If accessing from the back office I believe you can get there Settings -> Partials this will take you to the partials folder on disk.

    What you could then do, is find the for each loop that is going around Model.Fields (I think it's around line 151 assuming the file is currently unmodified).

    You could then filter the results to make sure that there is a value in field.GetValues() (but I'm not sure what helper method there is for this) and then only put results where it's true.

    That, I think, should give you what you are after, unfortunately I don't have a site to test this on for you right now so it's only theoretical but hopefully will point you in the right direction?

    Thanks

    Nik

  • naitsirhc 15 posts 117 karma points
    Feb 06, 2019 @ 10:46
    naitsirhc
    1

    Thanks! that was what I was looking for!

Please Sign in or register to post replies

Write your reply to:

Draft