Forum OpenACS Q&A: Rendering of textarea fields.

Collapse
Posted by Richard Hamilton on
I have discovered by experimentation that if I set a basic textarea in an xowiki::Form, its contents are rendered as text. So even if I enter some html, it is rendered literally.

I have resolved this by setting the textarea,richtext parameter and entering my html into Xhina, but for the sake of better understanding.....

Is there a parameter for a simple textarea in an xowiki::Form that would cause the select box to be displayed that allows the user to select between 'Enhanced Text, Plain Text, HTML or Fixed Width'?

or alternatively,

could I achieve this in a similar way to the redirect explained in the previous post, by defining a subclass of the field object textarea and providing a custom renderer for it?

Am I starting to get the idea?

Regards
Richard

Collapse
Posted by Gustaf Neumann on
if "richtext" is used, the widget expects finally HTML; the HTML is checked for safety by the validator. For input, one can use xinha (optionally as inplace editor) or wym. Enhanced Text etc. is currently not supported.

i am not sure, what you are asking, but one can paraphrase the three lines of code in
http://www.openacs.org/forums/message-view?message_id=3132748
by:
a) subclass the form-field class "text" as "redirect"
b) whenever an instance of class "redirect" is viewed,
use the specified value (the content of the field)
as redirection link.

note that form-fields are also rendered sometimes in view-mode, sometimes in edit-mode (i.e. someone edits the contents of the field), so there are different renderers for form-fields.

Certainly, one can do subclassing, refining, extending etc. not only for fields of type "text", but as well for all other form-field classes (e.g. "textarea" or "richtext, "checkbox" or whatever).