Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Include Heading and Rich Text fields in emails #93

Open
LeaTark opened this issue Feb 21, 2017 · 1 comment
Open

Include Heading and Rich Text fields in emails #93

LeaTark opened this issue Feb 21, 2017 · 1 comment

Comments

@LeaTark
Copy link

LeaTark commented Feb 21, 2017

Headings group fields nicely in forms but are absent from emails.
Some text may also be a statement that we ask people to agree to so is an essential part of the email.

@Nicholas-Westby
Copy link
Contributor

For anybody who works on this, I'll outline what's going on and some recommendations for addressing the issue. I'll focus on the "Header" field type, but it applies equally to the "Rich Text" field type.

First, the header field doesn't send any data to the server when the form is submitted, and so the submissions controller doesn't pass on this field as one that should be included in an email. Here's the data that get submitted in the submissions controller:

The first thing that probably ought to change is to set a value for the header field so the submissions controller knows to pass it along to handlers for inclusion in emails. A good place to do that might be when the frontend field is created:

return angular.element('<h2 class="formulate__header" ng-bind="fieldCtrl.configuration.text"></h2>');

Since many people will not want headers in their emails, it probably makes sense for this feature to be opt in. That could either be at the form level or at the handler level. I'd suggest that this would be better suited at the handler level, as it seems odd for fields to know about specific handlers (i.e., it'd be weird for the header field to have a setting to ensure it gets included in emails).

I'm imagining a setting on the email handler that says something like "Include Transitory Fields?" Then the description for that setting would say something like "Transitory fields are fields that don't have any data associated with them, such as headers, rich text, and buttons." This setting might go here between these two other settings:

email-handler

Finally, you'll need to modify the code in the email handler to ensure the "Text Value" for the header is included in the email:

header-field

You'll also want to consider how this change might impact the other form submission handlers, such as "Send Data" and "Store Data" (not to mention other custom ones other people may have written outside of the core of Formulate).

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

No branches or pull requests

2 participants