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.

All other Modules /

Discuss all other Modules here.

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

Userforms - Removing HTML Fields From Email


Go to End
Reply


14 Posts   1487 Views

Avatar
Liam

Community Member, 470 Posts

26 November 2011 at 10:56am

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?

Avatar
Willr

Forum Moderator, 5513 Posts

28 November 2011 at 10:41pm

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

Avatar
Liam

Community Member, 470 Posts

30 November 2011 at 6:07am

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.

Avatar
Willr

Forum Moderator, 5513 Posts

30 November 2011 at 9:44am

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.

Avatar
Liam

Community Member, 470 Posts

30 November 2011 at 9:51am

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

Thanks for the help.

Avatar
Liam

Community Member, 470 Posts

1 December 2011 at 8:39am

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.

Avatar
Willr

Forum Moderator, 5513 Posts

1 December 2011 at 10:27am

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

Avatar
Liam

Community Member, 470 Posts

1 December 2011 at 2:16pm

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.

Go to Top