[Zope] retrieving data from REQUEST.form

Kapil Thangavelu kthangavelu@earthlink.net
Fri, 11 Aug 2000 06:13:26 -0700


jesse wrote:
> 
> I am creating a program, yet again.  How this works is,
> 
> a zope factory calls a form, which submits data from a <textarea> to a DTML document.  I want this DTML document to take the data from the form and display it on multiple lines. For instance:
> 
> If a person fills out the textarea like so:
> 
> First line
> second line
> third line
> 
> I want the DTML document to print out:
> 
> First line
> second line
> third line
> 
> The only problem is, when the <textarea> submits to the document, (lets say the textarea is called list), it submits it as a dictionary.  That means all the data is on a SINGLE STRING.  So the data from the form looks like this.
> 
> <dtml-var "REQUEST.form"> =
> {'list': 'first line/015/012second line/015/012third line'}
> 
> the /015/012 represent the line breaks.
> 
> Seeing this, i used the replace function in zope, trying to replace the line breaks with <br>, which would be accepted by html.  however, whenever you try and access the information in the form as a string...
> 
> <dtml-var "REQUEST.form['list']">
> 
> it comes out with
> 
> line one line two line three
> 
> All the line breaks dissapear! So there is nothing to replace! Does anyone have any ideas how I could solve this problem?
> 


if you're inserting data with a <dtml-var> you can take advantage of
Zope's formating options one of which happens to be newline_to_br

try
<dtml-var "REQUEST.form['list']" fmt=newline_to_br>

Kapil