[Zope] Adding Carriage return/line feed to a text field

J Cameron Cooper zope-l at jcameroncooper.com
Thu Apr 21 15:16:55 EDT 2005


MCDONNELL, LARRY wrote:

> I have a form that the field length for that element is set to 65k in 
> the database. Using a textbox, the person can enter their information. I 
> now want to view the text. I can again use a text box but what I want to 
> do is this –
> 
> <dtml-var mytext>
  >
> If I use this format, the text is one line. Are there arguments or a 
> script that will add carriage return/line feed after you set the parameters?

You can wrap it in HTML <pre> tags. This preserves formatting on layout.

Otherwise, you'll have to replace the newlines in your text with <br/> 
tags. Products.PythonScripts.standard.newline_to_br will do this for 
you, as will the newline_to_br attribute on the dtml-var tag. (You can 
find this in the Zope online help.)

		--jcc


More information about the Zope mailing list