Gang, I have a textarea-form here that looks like this: <form action="manage_addTEXT" blabla... <textarea blabla> </textarea blabla> </form> The function manage_addTEXT(self, TEXT="") gets the text from textarea as string in TEXT. It splits the text by using string.split(TEXT, '\n') into lines and stores each line in a database. For editing the TEXT I use a .dtml-script that re-assembles the text line by line: <textarea><dtml-in sqlFetchTEXT><dtml-var LINE></textarea> Please note, that I write it all without any spacing between the tags. One could think that this results in having the lines being displayed in the textarea like this: Line00Line01Line02Line03 but thats not the case. For some reason we see Line00 Line01 Line02 Line03 How's that possible? string.split() removed all the newlines. If I check the database via select LINES from TEXTBASE I see that each line is, in fact, stored separately. If I call manage_addTEXT() directly, however, i.e. not from a form, and pass a bunch of lines to it: manage_addTEXT(TEXT="ichi\nni\san\nshi\n") I end up with all lines concatenated into a single line in my edit-form that so nicely displays the put in via a form. Why is this so? There must be something about how \ns are conveyed via HTTP and how Zope handles it what I don't know. Theories, anyone? Thanks PAGE ______________________________________________________________________ Do you want a free e-mail for life ? Get it at http://www.hotmail.ro/
Page Page]
... For editing the TEXT I use a .dtml-script that re-assembles the text line by line:
<textarea><dtml-in sqlFetchTEXT><dtml-var LINE></textarea>
I hope this is not exactly your code, because the dtml-in element doesn't end within the textarea. Assuming that it really is closed properly, you may have an unnoticed line feed, like this: <textarea><dtml-in sqlFetchTEXT><dtml-var LINE> </dtml-in></textarea> If so, that line feed may be showing up. If the dtml-in element is not closed within the textarea, I'd say the results are unpredictable. Have you look at the actual HTML output that you get to make sure it is what you expect?
Please note, that I write it all without any spacing between the tags. One could think that this results in having the lines being displayed in the textarea like this:
Line00Line01Line02Line03
but thats not the case. For some reason we see Line00 Line01 Line02 Line03
How's that possible? string.split() removed all the newlines.
If you don't have a stealth linefeed like the above, I don't really know. Cheers, Tom P
participants (2)
-
Page Page -
Thomas B. Passin