views:

42

answers:

1

In our Cocoon environment we have a few forms with textareas. Once the user submits a form, an overview is displayed before the final submit is done. Therefor, each form-object's data is stored in POJOs. If the user is on that overview page and decides to go back to the form, the form is filled with the already submitted data read from the POJOs. However, when filling the textarea with data from the JavaObject, some linebreaks and whitespaces are added to the data. I checked the POJO's data for these linebreaks but the String looks clean. Each whitespace entered by the user is of Character 32, which is a simple space.

I also checked the Serializer (we use a custom one that extends Cocoon's AbstractSerializer) but no linebreaks/whitespaces added by accident here.

When using Javascript to output the current content of that Textarea though, it contains linebreak characters ('\n') as well as the aforementioned additional whitespaces.

My suspicion is that the conversion from Java's Space-Character to HTML's space characters somehow fails. These linebreaks appear instead of spaces, not inside a single word. They also change position depending on the textarea's size. They are not at the end of a line, so they can't be forced by wrap or something.

Example: User input "test test test test test" becomes "test\n [36x Space] test test test test"

A: 

Here's a thought... What do you use to actually output the page to the client? I'm not entirely familiar with the Cocoon environment but I assume you're using some sort of a "templating" engine (JSP? Velocity?). I'm talking about the actual file, on the server side, that has the textarea element; paste here the snippet of code that involves the textarea element and we'll see.

Isaac