[Zope] retrieving data from REQUEST.form

Patrick Lewis pl@teleport.com
Fri, 11 Aug 2000 10:46:22 -0700


On Fri, Aug 11, 2000 at 01:08:48PM -0400, 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?  
> 
A couple of questions:

- You say that <dtml-var "REQUEST.form['list']"> returns 
  line one line two line three
  Is that in your browser window, or did you view the source html?

- Does <dtml-var "_.string.replace(REQUEST.form['list'], '\015\012',
'<br>')" > work?

-- 
Patrick Lewis <pl@teleport.com>