Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Userforms - Removing HTML Fields From Email

Discuss all other Modules here.

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

Page: 1 2
Go to End
Author Topic: 1313 Views
  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

    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.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

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

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

    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.

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

    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 %>

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Userforms - Removing HTML Fields From Email Link to this post

    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.

    1313 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.