1

I want a line break in the #attributes, I've mentioned it in the code as in where I want the line break to be.

$form['advanced_user_data'] = array(
    '#type' => 'textarea',
    '#attributes' => array('placeholder' => array('"Jack Polard" <jackpolard@xyz.com> (Want a   line break here) "Miky Town" <miky@abc.com> (Want a line break here) "Bill Gates" <bill@example.com>')),
    '#description' => t('Eg: "Full Name" &nbsp;&nbsp; < emailid@domain.com >'),                                                       
);

See this is how it has to be, "\r\n" didnt work, I'm a HTML guy, so I have no knowledge of PHP, please help me in a simpler way.

Screenshot

Awesomestvi
  • 783
  • 1
  • 5
  • 14

2 Answers2

1

i think your linebreaks should used in a textarea use &#10; this is command for newlines in html. give this a try.

// edit after comment

try

'#attributes' => array('placeholder' => array('"Jack Polard" <jackpolard@xyz.com>
                                                "Miky Town" <miky@abc.com>
                                                "Bill Gates" <bill@example.com>')),

if this and the other solutions ... \n etc... not work, i think the output to your textarea gets htmlescaped, so you can't use linebreaks as long the complete output gets escaped.

ins0
  • 3,918
  • 1
  • 20
  • 28
0

Most of the time \n or \r\n or PHP_EOL will do the trick. Just try which one works for you. If you echo to html you should use <br>.

three_pineapples
  • 11,579
  • 5
  • 38
  • 75
tkon99
  • 156
  • 11