CakePHP - Setting up the default value for a Form->input : I want to have a line break, but how?

17,284

Use \n

echo $this->Form->input('story', array('default'=>'Thanks for visiting my campaign page.\nBe sure to check out the links below'));
Share:
17,284
Zaphod Beeblebrox
Author by

Zaphod Beeblebrox

Updated on June 11, 2022

Comments

  • Zaphod Beeblebrox
    Zaphod Beeblebrox almost 2 years

    I have a form input whose default value I want to have as a couple of short paragraphs. eg in my view:

    echo $this->Form->input('story', array('default'=>'Thanks for visiting my campaign page. Be sure to check out the links below'));
    

    At the minute that works ok and creates a text box filled with those two sentences, but I'd prefer to have them on two different lines. And also saved in the DB as such so when they're recalled they automatically appear in two paragraphs. I've tried <p> tags etc but they just turn up in the text.

    Is there some way to create a line break when setting the default value in the view which will be stored in the DB as a line break etc...?