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: 1318 Views
  • Liam
    Avatar
    Community Member
    470 Posts

    Userforms - Removing HTML Fields From Email Link to this post

    I've created a form that has multiple html fields. When the form is submitted, the email is filled with values like EditableLiteralField# everywhere I used an html field.

    Is there a way to remove them from being included in the email that is sent out?

    Possible by just editing the .ss template and doing an if check for the field type and not writing it if true?

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

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

    Add a function showInReports() { return false; } to your EditableLiteralField.

    Can't imagine why it'll need to be included anyway. Perhaps it should be an option in the CMS to include it in the email (off by default).

  • Liam
    Avatar
    Community Member
    470 Posts

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

    Thanks. That did it. And yes, I'd prefer it if future versions had this by default as I don't see the point in including it in emails.

    I'd also like it if you could set the col width for textareas in the admin panel as well. I only see an option to do rows, unless I'm missing something. Just styled it via css for now, but not as flexible if I want my client to do it.

    One last thing. In the emails being sent, single quotes are being replaced by the html entities. So the title of the field in the email looks like this for example. Patient's First Name instead of Patient's First Name

    I'm using html emails.

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

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

    You're using the latest master?

    Raise all those as tickets (either bugs or enhancements) on open.silverstripe.org so we don't forget them. Assign them to userforms and wrossiter (me) and I'll ensure they're fixed for the next release.

    Currently the plan from me is to get a UserForms 0.4 out as udf master has a year of bug fixes since the last 'release'. 1.0 will be released after SS3.0 beta.

  • Liam
    Avatar
    Community Member
    470 Posts

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

    Ya I'm using master from github so I'll add those to the bug tracker at some point today.

    Thanks for the help.

  • Liam
    Avatar
    Community Member
    470 Posts

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

    Hi Will,

    Is there an easy way to set it so if a field isn't filled out in the form, then it isn't included in the email template? Not all my fields are required, so some can be blank, but the title of the field is included in the email body which isn't necessary.

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

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

    You could try a custom template for the email that just has a <% if FormattedValue %> wrapper around the dt/dd.

    https://github.com/silverstripe/silverstripe-userforms/blob/master/templates/email/SubmittedFormEmail.ss

  • Liam
    Avatar
    Community Member
    470 Posts

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

    Is there a way to set custom templates with this module per form or are you saying to just edit the file you linked me?

    I knew it was possible to set custom templates when you did the forms by hand. I didn't think it was possible with this module.

    1318 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.