The Toolkit for Online Communities
18917 Community Members, 1 member online, 1638 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Rendering an ad_form without formtemplate tag

Forum OpenACS Development: Rendering an ad_form without formtemplate tag

Icon of envelope Request notifications


I'm trying to render a template form from within a TCL page (not an ADP page). I really have no other choice, because I need to pass the rendered form as a parameter to a master template (to be embedded in a side-bar).

Checking the code for template_tag formtemplate { chunk params } { ... } doesn't look at all promising.

One solution that works is to create separate form.tcl + form.adp files with the form definition in it and to use ad_parse_template to parse this file. However, this is a) clumsy (code spread around, more code) and b) slow (parsing another file, etc.).

Does somebody have the solution?

Thanks in advance!

Posted by Dave Bauer on
You can render the ADP that contains the formtemplate tag using


this should do what you need.

Posted by Gustaf Neumann on
This costed me some hairs as well. xowiki renders ad_forms using adp_include and returns the result as HTML. One can reference via the included adp-chunk different form templates. Checkout in xowiki/tcl/xowiki-www-procs the method Page->edit (build a form via ad_form). Page->edit calls finally Package->return_page (in xotcl-core/tcl/06-package-procs).

Maybe this helps
-gustaf neumann

Posted by Frank Bergmann on
Thanks a lot for the answers!!


Posted by Frank Bergmann on

The code still needs to run on OpenACS 5.1, so adp_include doesn't exist there. But looking through the source I found this very simple solution:

eval [template::adp_compile -string {[formtemplate id="project_filter"][/formtemplate]}]
set filter_html $__adp_output

(replaced angle brackets by brackets because of restrictions here in the forum...)

This version doesn't cache the compiled code, but that performance penalty should be OK because it's quite a short piece of code.