Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Userforms - Removing HTML Fields From Email


Go to End


14 Posts   2740 Views

Avatar
Willr

Forum Moderator, 5523 Posts

1 December 2011 at 5:13pm

Well just like any other template in ss you can override it from your theme. Copy the file I linked you to themes/yourtheme/templates/email/* and edit as you wish!

No need to edit the module code for templates.

Avatar
Liam

Community Member, 470 Posts

1 December 2011 at 5:38pm

So are you saying if I created 3 forms with this module, I can create 3 different email templates for each one? What do I name them?

I'm seeing that each form is outputted with the same id of #Form_Form which is not unique.

Avatar
Willr

Forum Moderator, 5523 Posts

1 December 2011 at 5:45pm

Sorry, missed the multiple keyword in your post, no you can't set custom templates on each individual form in the module.

Avatar
Liam

Community Member, 470 Posts

1 December 2011 at 5:56pm

Ya didn't think so, but you got my hopes up a bit ;) Not a huge deal as the default is fine. My client had just wanted 1 form a bit tweaked, but it's nothing major anyway.

Thanks for the help though. The <% if FormattedValue %> worked perfectly for removing blank fields.

Avatar
Liam

Community Member, 470 Posts

29 September 2012 at 8:27am

I upgraded the site to 3.0 and I'm not sure if something changed, or it never worked like this. I'm leaning towards something changing.

When fields are left blank, I don't want the $Title being included in the email, but they are.

My template and I have flush?=all

<% if HideFormData %>
<% else %>
<dl>
<% control Fields %>
<% if $FormattedValue %>
<dt><strong><% if Title %>$Title<% else %>$Name<% end_if %></strong></dt>
<dd style="margin: 4px 0 14px 0">$FormattedValue</dd>
<% end_if %>
<% end_control %>
</dl>
<% end_if %>

Avatar
Liam

Community Member, 470 Posts

30 September 2012 at 2:13pm

Figured it out.

My folder for the email templates didn't have the capital E. So it was 'email' instead of 'Email' in mysite/templates/

So the custom template I had setup wasn't overriding.

This worked in 2.4 but not 3 if it happens to anybody else.

Go to Top