Re: Setting up the default value for a Form->input : I want to have a line break, but how?
Hi Barricades,
Using plain-jane PHP, there's an nl2br() function that translates the
newlines into <br /> whenever you decide to output the contents of
your field. Since you were going for a <p> instead of a <br />, have
you considered storing your data in plain text, and then formatting
them upon output using Textile or Markdown? These are lightweight
markup languages that convert your plain text into HTML-formatted
output. You might want to visit the Bakery and search for some Helpers
for any of those. All you need to do is include the Helper in your
code, and use it to process text in your views.
Hope this helps,
OJ
On Jun 8, 7:30 am, barricades <davow...@googlemail.com> wrote:
> 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...?
>
> thanks
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home