Score:0

How can I avoid double line breaks (

) in a text field (field type: text unformatted long)?

ke flag

How can I avoid double line breaks (<br><br>) in a text field (field type: text unformatted, long)?

Users write text into this text field. When they hit Enter twice, the result is: <br><br>. But <br><br> is not themable with css, the height of <br> can NOT be set with css.

Therefore <br><br> should be avoided and paragraphs <p> used instead of it. <br><br> should never be saved to database. How can double <br><br> be avoided or replaced with <p> before the the field is saved?

mx flag
Does your Text format have the `Convert line breaks into HTML (i.e. <br> and <p>)` option enabled?
ke flag
This is NOT a textformat, so a can NOT enable this option. This is a field from type "text unformatted long". Unformatted fields do not have any options like those.
mx flag
The Plain Long text field is still controlled with the Plain text Text format. But there seem to be bugs and not enough agreement on how to handle different cases: https://www.drupal.org/project/drupal/issues/1152216#comment-5875568, https://www.drupal.org/node/1095838, https://www.drupal.org/project/drupal/issues/1017662
mx flag
An answer here might be helpful as a workaround using the module Advanced Text Formatter: https://drupal.stackexchange.com/questions/38666/how-do-i-get-line-breaks-when-using-plain-text-format
ke flag
The module "Advanced Text Formatter" solves this problem.
Score:-1
hk flag

You can style br tag in CSS, but before you need to reset it by using these declarations:

br {
  display: "block";
  content: "";
}

Then you can style it as you want, it can be done using margin property, so the code will be such as:

br {
  display: "block";
  content: "";
  margin: 1em 0;
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.