Forum OpenACS Development: Re: HTMLarea and ad_form/form builder

Collapse
Posted by C. R. Oldham on
I've learned a lot.  I'm still stuck in a few areas though.

To begin with, it's worth mentioning that with ad_form, a richtext widget (HTMLarea or the old richtext) is not the same thing as a simple tcl variable.  A richtext widget presents a two-element list (I think)--the first element is the actual text, and the second element is the content type (always text/html in this case).  So when you are going to expose some value you have to code it as a list or what happens is ad_form only shows the first word (because it sees that as the first list element).

This means you have to massage the stuff that comes in and goes out to the database.  I hacked it and just said

set html_body [list $html_body]

because I couldn't figure out the right syntax for the accessor functions for the richtext widget.  That's for loading the content into the form.  For saving the content from the form, fortunately Malte gave us a well-designed mailing-list api, and it was easy to add "template::util::richtext::get_property contents $html_body" to the right places.

Secondly, I punted and only used HTMLarea for the html_body portion of the mailing list.  I figured that the header and footer would be small enough that you could hand-code them, or skip them all together.

I think I've just about got this all fixed using just one HTMLarea.  Do you want patches?