Hello!

I really apologise if the issue is already solved - I've been googling for 2 hours and couldn't find the solution. When a form is submitted, the email message contains some excess line breaks (<br />) that need to be removed. They appear in the middle of a line which is not wanted. The desirable result is one line displaying one field (Label: Value) without any breaks. How can I remove them? Please, help me out :)

CommentFileSizeAuthor
2013-12-12_1749.png7.33 KBEternalLight
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Issue summary: View changes
quicksketch’s picture

Hm, I'm not sure what could be causing this. It looks like you're sending e-mails as HTML. So do you have the MIME Mail module installed? If you send the mails as plain-text, does the same problem occur?

associate’s picture

Think this is the same issue I'm having
https://drupal.org/node/2157325

quicksketch’s picture

Category: Support request » Bug report

Thanks @associate for filing that bug report at #2157325: Email Results Formatting Issue. Let's consolidate these two requests here. From that issue:

When I receive submission results for 1 of my webforms, one of my questions is returned as the following in the email

Q. Where do you want the item to be covered? Both in and
away
from
home

It's adding in a line breaks into the select value.

I created a new select with the same options and the same thing happens.

The field is nestled within 3 fieldsets but I've tried it in 1 and 2 fieldsets and it still adds line breaks but not as many. It seems it's to with the length of the question and answer.

Webform indeed includes some handling to prevent long lines in responses. According to the spec for e-mails, all mails are *supposed* to be wrapped after a certain text length. However, this doesn't apply to HTML-sent e-mails, which shouldn't be getting these <br /> tags added.

@associate is also correct that the more fieldsets you have, the more results get nested and the more likely the text is to wrap.

The code that is likely causing this wrapping is in theme_webform_element_text():

  // Wrap long values at 65 characters, allowing for a few fieldset indents.
  // It's common courtesy to wrap at 75 characters in e-mails.
  if ($is_group && drupal_strlen($value) > 65) {
    $value = wordwrap($value, 65, "\n");
    $lines = explode("\n", $value);
    foreach ($lines as $key => $line) {
      $lines[$key] = '  ' . $line;
    }
    $value = implode("\n", $lines);
  }

You can override this in your theme to try an fix the problem. Ideally, we'd find a way to prevent the problem from happening for all users, so if you come up with any good ideas, I'd be happy to review them for including in the main module itself.

DanChadwick’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev

While 7.x-3.x is receiving critical fixes only, I think this issue still applies to 7.x-4.x.

DanChadwick’s picture

Status: Active » Closed (won't fix)

Closing for lack of activity. It's not clear whether this still happens in 7.x-4.x.