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 hidden fields from submitted data in email


Go to End


1287 Views

Avatar
Liquid Edge Creative

Community Member, 56 Posts

27 July 2016 at 3:44pm

Hi all,

We have a form that makes extensive use of Display Rules to hide fields by default and only show them when other fields are completed in a certain way.

It seems that regardless of whether a field was displayed and/or completed by the user, the data for that field is still included in the email on submission.

I've been scratching my head trying to work out how to remove hidden fields from the email, for example using a conditional in the template such as:

<% if $Display == 'Show' %>

($Display being an Enum defined in EditableCustomRule.php with values of Show and Hide.)

Any bright ideas?