I have Filed in my content type with widget Text area (multiple rows). when some one paste content into this having line breaks, my requirement is to remove line breaks and save it in single line text.

I have selected Text processing as Plain text in filed settings. And in plain text format support to convert line breaks into html br tag is not checked.

Please suggest some way to remove line breaks while pasting content into this field.


enter image description here


enter image description here

In short is there any way to Make textarea to behave like textfiled while saving content ?



Check that the field is set to plain text in the "Manage Display" page of your content type.

| improve this answer | |
  • Thanks, that I know it will start displaying it into plain text. But I was looking that I can give users multiple lines to enter but that must get saved into filed without line breaks so I did some jqery like this : $("#my-filed").bind('paste', function(e){ var el = $(this); setTimeout(function() { $(el).val($(el).val().replace(/(\r\n|\n|\r)/gm," ")); }, 100); }); – jas Feb 17 '16 at 9:01
  • When some one past content having line breaks it will be converted into single line by this jQqery code. Is there any other way to achive this ie: without jqery ? – jas Feb 17 '16 at 9:04
  • CSS is an option.. I don't know that much about formats in Drupal. css-tricks.com/almanac/properties/w/whitespace – Niall Murphy Feb 17 '16 at 9:07
  • Actually I want to behave textarea like textfiled. so its working fine for me by applying jqery but I was trying to do without jqery in more proper way ! – jas Feb 17 '16 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.