Forum OpenACS Development: Re: losing data from richtext after ad_form validation

Posted by Antonio Pisano on
Hello Priya,

could you tell me if you build your fields using ad_form or by direct template::* commands?

Also, what version of OpenACS are you running on?

I had some problem with richtext fields some time ago because I didn't consider that they are not a single value, but in fact a list of {content mime_type}. Maybe this is related to your issue.

Posted by Priya Rao on
Hi Antonio,
Thanks for the response. I am using ad_form and OpenACS version is 5.8.0.

Here is how I am using it:

ad_form -name user_info -form {
{name:text(inform) {label "Name :"} }
{interest:text(richtext) {label "Narrative :"} }
{keywords:text(text) {label "Keywords :"} }
} -edit_request {

# Get interest for the main site.
db_0or1row get_interest_and_keywords { }
set interest [template::util::richtext::create $interest text/html]

} -mode display -edit_data {

# Insert or Update research narrative

} -after_submit {



Posted by Antonio Pisano on
I think the guilty here is "display" set on the mode flag. If you change it to "edit", everything should work fine. Is there a reason why you set it on "display"?

From docs, it states that when a button is clicked, form should switch to edit mode automatically, but I don't know exactly what this should mean... Actually, I don't know if the behavior you have shown is correct either... form should not swallow your text whatever mode you give it.

Anyway, that should fix your problem.

All the best