email notification data

Denica Daceva asked on August 6, 2015 10:03

Hello dears, on our site we have form with many text box fields and we want after submission only the filled in label-value couples to be send with the email notification. Is there any macro expression to do this? Thank you for your support!

Correct Answer

Denica Daceva answered on August 10, 2015 16:53

Hello, Latest update:

<div>{% if (FieldName >= 1) {"$$label:FieldName$$ : $$value:FieldName$$"} else {""} @%}</div>

I read in a post that @ at the end of the macro statement removes the security measures. Thank you! Be well,

0 votesVote for this answer Unmark Correct answer

Recent Answers


Predictes Kentico-Admin answered on August 6, 2015 13:00 (last edited on August 6, 2015 13:01)

Hello Denica,

You can create custom layout of email notifiation. You can find it in one of the tab when you select your form. There you can specify which fields you want to send.

More information you can find in documentation

Best regards :)

0 votesVote for this answer Mark as a Correct answer

Charles Matvchuk answered on August 6, 2015 23:13

Actually I think she wants to send the pairs that are only filled in. I do something similar but have custom macros to check for value then get label.

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on August 7, 2015 05:13

I'd try something like this:

  • Wrap every label-value item into some html element, e.g. DIV
  • Set it's display property with macro:

<div style="{% if(fieldName == "") {"display:none;"}%}">

So physically alll the fields are present in the email, but empty are hidden.

1 votesVote for this answer Mark as a Correct answer

Denica Daceva answered on August 7, 2015 10:45

Hello, Thank you all! I tried with the macro method for the styling, but I think my syntax is wrong, because it renders empty divs. The double quotes need to be excaped. Well, I keep on trying! Thank you!

0 votesVote for this answer Mark as a Correct answer

Denica Daceva answered on August 7, 2015 11:47

Hello again,

I did something like:

{% a = $$value:fieldname$$; a < 1 ? "" : "$$label:fieldname$$: $$value:fieldname$$" %}

Which means I have to write it for each field (and stupid, but we have over 30).

Until something better come on the way, I will stick with that.

Thank you for the support!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.