Customize Summary in emails from #Episerver Forms

Episerver Forms is getting stronger. Here is a example of the how to customize the summary text with PlaceHolderProvider that is available in version 4.4.

Published 10th February 2017
For Episerver Version 10 and Forms 4.4

PlaceholderProvider in the Episerver.Form.UI  Namespace >4.4 can be used to override the processing of the Placeholder tags #yourelement#

Placeholders are handled with PlaceHolderService. You can replace PlaceHolderService with your own implementation with Dependency Injection.

But in this example i will extend the DefaultPlaceHolderProvider
because i want to reuse the code and override some methods.

DefaultPlaceHolderProvider is the default implementation of IPlaceHolderProvider, which replaces FormElementPlaceHolders with an actual value and provides an extra #SUMMARY# placeholder.

I will add an ExtraPlaceHolder called #FriendlySummary#, that takes away all hidden fields.

Why Changing the summary:

Editors may use summary in every email when confirming the submission to the user. When they used hidden element, they also where showed in summary, and we don’t want that.

Solution:

A form element that is implementing IExcludeInSubmission is automaticly not displayed in Summary, like the captcha element, but IExcludeInSubmission not applicable in this case.

My condition: All form elements with name starting with “Hidden… “ like “Hidden IP” or “Hidden VisitorGroup is returning user” or “Hidden anything” will not be displayed in my #FriendlySummary#

But you can also exclude PredefinedHiddenElementBlock or whatever block…

The form with hidden fields:

 

 

The email message:

The emailed result:

The idea in this example is to replace the value shouldNotShowInSummary with a real code, could be done in this provider code.

The Code example

Summary:

Episerver Forms is getting better and better, PlaceholderProvider is great news. Even better would be to add a new property on BaseElement called “HideInSummary” by default.

Gist:

Source:

SEO Terms:

  • SendEmailAfterSubmissionActor
  • Replacing input fields with custom data after submit
  • Changing field output in email
  • Customize Summary placeholder
Like it? please up vote
2