<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>I just tried this on a D7 test site and the "\n" worked fine for me.</span></div><div><span><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp; $default = array('a' =&gt; 'line 1', 'b' =&gt; 'line 2', 'c' =&gt; 'line 3');</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp; $form['test'] = array(</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp;&nbsp;&nbsp; '#type' =&gt; 'textarea',</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp;&nbsp;&nbsp; '#title' =&gt;
 t('Textarea'),</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp;&nbsp;&nbsp; '#default_value' =&gt; implode("\n", $default),</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;">&nbsp;&nbsp;&nbsp; );</span><br style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br></span></div><div>&nbsp;</div><div><font color="#ff007f" face="bookman old style, new york, times, serif" size="4"><i><strong>Nancy</strong></i></font></div>&nbsp;<div><font face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</font></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: arial,
 helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Sponge Harkonnen &lt;cksponge@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> support@drupal.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Friday, February 10, 2012 1:01 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [support] Add multi-line text to a textarea<br> </font> </div> <br>
<div id="yiv448127673">Hey all,<br><br>I'm trying to add a default value that has multiple lines to a text area and am unable to add line breaks. The default value is being built out of an array with the goal that each entry of the array is on it's own line. Adding \n, \r\n, or \r only adds the \n,\r\n, or \r as text and not as a new line. Is there some sort of preprocessing I need to do to the text in order to get the line breaks to show up in the textarea?<br>
<br>Code:<br>$codes = variable_get('somevariablename', array());<br><br>$display = '';<br><br>foreach ($codes AS $key =&gt; $value) {<br>&nbsp; $display.= $value . "\n";<br>}<br><br>$form['textareatitle'] = array(<br>
&nbsp; '#title' =&gt; 'Title',<br>&nbsp; '#type' =&gt; 'textarea',<br>&nbsp; '#default_value' =&gt; $display,<br>);<br><br>Any help or pointing in the right direction would be appreciated. Thanks!<br>
Ben<br>
</div><br>-- <br>[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br><br> </div> </div> </blockquote></div>   </div></body></html>