I have implemented my own set of custom UGC controls that load and save data via the oData service to support commenting on articles in a Tridion 2011 SP1 site. The client has requested that we allow comments to contain multiple paragraphs. If I add a line break to a comment this is removed when the comment is saved. This is the case in both the Comments moderation interface within the CMS as well as when I save a comment using my custom control.

Is it possible to configure UGC to maintain the line breaks in the comments? I can't find any reference to this in the UGC section of the install manual. Is this a limitation of the oData service?

One option would be to change my control so that it replaces the line feeds with
tags before it sends them to the oData service. This works but makes the comments less readable for the moderator. Is there a setting I am missing that would allow the line feed information to be maintained?

1 Answer 1


I think only with settings is impossible to mantain the line breaks in the textarea. The exactly point where the line breaks are cleaned is the class "Jsoup.clean" in the validation of the input text to avoid XSS (Cross Site Scripting)

Jsoup.clean(comment.getContent(), UGCConfigurationLoader.getCommentWhiteList());

in the service where the comments are saved (WritableCommentEntryService).

It is possible to give a list of html elements to allow, but the line breaks are cleaned also.
Try seeking information of this library (http://jsoup.org/)

  • Thanks for the info Raúl. I think for now I will go with the solution of replacing the line breaks with <br> tags before I send them to the oData service. If the client doesn't like seeing the <br> tags in the moderation interface I will look at overriding this method in the WritableCommentEntryService. Commented Feb 21, 2013 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.