Would it be possible to not include hidden conditional fields in the emails generated by a form submission?

Comments

Anonymous’s picture

I second that request. It seems logical that the only values that should be emailed are those that the user filled out. Why should they see multiple fields that they never saw in the first place? I'm willing to test if someone needs/wants help with that part...

drupalhopper’s picture

I'm having this issue as well. I see no one has commented on this in a while, but when I create the custom template for email generation - my hidden conditionals that are not used for that email subject are showing up on the emails as %email[key]

Anyone have any idea how to hide conditionals from the emails?

tedbow’s picture

Status: Active » Needs review

I have added this in the latest dev release. I have not tested this for email but it should be the same as viewing a submission. Can someone test this with the update module for me and reply back here. thanks.

drupalhopper’s picture

Still not really functioning the way I would expect.

I'll try to relay this the best I can - I've never really tried to do this before so forgive me if I pass this on ineffectively...if so I will try again :)

Am I wrong, or shouldn't they just show up in the email with the Field Key Name: ____ (i.e. Your Email: ____) as opposed to %email[test_field] in the spot allotted for the field....unless they were revealed - and potentially have values entered?

I have a topic that has three secondary subjects

Main topic A
Secondary subjects A, B & C
The field should only show up for Main Topic A/Secondary subject A (working correctly)

I'm using email routing based off of the option key of the Main Topic A Option list component - subject is a hidden field

So, in the Custom Template for the email, I am including the %email[key] for the Conditional field I mentioned above - and I would like it to either be blank in the sent email if it's not been revealed, or show blank if it has been and hasn't been filled out (which is working correctly), or a value if it has been filled out (also working correctly)

tedbow’s picture

@drupalhopper, not sure I am following everything you wrote.
Right now how I think it should work is if a field was hidden it will not show up at all in the email. Meaning the neither the label or value will show.

Is that what is happening?

drupalhopper’s picture

That is how I would think it SHOULD work - but what is occurring is that if the field is hidden - the %email[key] is showing up in the email - exactly as it is there...as if it's an error. An email example would be as follows:

Submitted on Wednesday, December 22, 2010 - 12:41

Select a Topic: Restaurant/Dining Experience

Restaurant/Dining Experience: Carry Out

Which Restaurant did you visit? Test Restaurant, CO

Date You Visited the Restaurant:
(the above is showing up blank - as it should - because it's exposed)

Time of Day You Visited: Football Game

%email[test_field]
(this is showing up incorrectly because the field is NOT exposed - and only would be if the Secondary Subject A had been selected. If that value was - this would have shown up as test field: entered value)

Your Email: myemail@email.com

Comments: testing and stuff

Would you like us to contact you? Yes
__________________________________

Does that help explain it?

tedbow’s picture

Okay, thanks. Can you check to see it this is also happens when you view the submission directly in the drupal site as opposed to being emailed the submission?

Does it act the same?

drupalhopper’s picture

No, it appears to be acting correctly on the submission results. Showing as blank if not revealed i.e.:

Test Field: ____

rather than:

%value[test_field] or %email[test_field] (the hidden fields for the email subjects show up in the submission results as %value[key] - so I assume that if it was to show up incorrectly, it would be %value, rather than %email?)

Thanks!

tedbow’s picture

After further research I have found this issue also effects components that are used the regular "conditional rules" of the Webform module.

Basically whether you have used my module or core Webforms conditional rules the fields don't appear in the "webform_submitted_data" table. Therefore using %email[field_key] or %value[field_key] will not work for any conditional fields.

%email_vlaues will work though.

There is an issue here: http://drupal.org/node/991024

quicksketch suggests:

you can theme your e-mails by creating a webform-email.tpl.php file as described in THEMING.txt.

This would fix this issue also.

There is not an easy way to solve this problem without changing Webform.

I was thinking about writing a patch for Webform that would fix this issue for both modules but my focus now is on fixing Webform Conditional.

UPDATE:
I went ahead and wrote a patch for Webform. You can find it here: http://drupal.org/node/991024#comment-4052952

Hopefully it will be incorporated into the module.

tedbow’s picture

Status: Needs review » Closed (won't fix)

Changing to "Won't fix" b/c I think this need to address directly in Webform with my patch or another way.