Re: [Zope] retrieving data from REQUEST.form
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 [EMAIL PROTECTED] ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] retrieving data from REQUEST.form
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 ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] retrieving data from REQUEST.form
jesse wrote: 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? The line breaks don't disappear, they just don't mean anything in HTML. You can still replace them. You can do dtml-var "_.string.replace(REQUEST.form['list'], '\n', 'br')" and it should do what you want. -- Nick Garcia | [EMAIL PROTECTED] CodeIt Computing | http://codeit.com ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] retrieving data from REQUEST.form
Nick Garcia wrote: jesse wrote: 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? The line breaks don't disappear, they just don't mean anything in HTML. You can still replace them. You can do dtml-var "_.string.replace(REQUEST.form['list'], '\n', 'br')" and it should do what you want. dtml-var "REQUEST.form['list']" newline_to_br Is much simpler. :) Just out of caution, I would not use 'list' as a variable, though. Bill -- Do not meddle in the affairs of sysadmins, for they are easy to annoy, and have the root password. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )