Index: openacs-4/packages/acs-core-docs/www/xml/developers-guide/form-builder.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/developers-guide/form-builder.xml,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/acs-core-docs/www/xml/developers-guide/form-builder.xml 4 Feb 2004 16:47:34 -0000 1.4
+++ openacs-4/packages/acs-core-docs/www/xml/developers-guide/form-builder.xml 28 May 2004 22:36:20 -0000 1.5
@@ -45,6 +45,51 @@
+
+ Using refreshes to pull additional information from the
+ database
+ A situation you may run into often is where you want to pull
+ in form items from a sub-category when the first category is
+ selected. Ad_form makes this fairly easy to do. In the definition
+ of your form element, include an html section
+
+ {pm_task_id:integer(select),optional
+ {label "Subject"}
+ {options {$task_options}}
+ {html {onChange "document.form_name.__refreshing_p.value='1';submit()"}}
+ {value $pm_task_id}
+ }
+
+
+ What this will do is set the value for pm_task_id and all the
+ other form elements, and resubmit the form. If you then include a
+ block that extends the form, you'll have the opportunity to add in
+ subcategories:
+
+ if {[exists_and_not_null pm_task_id]} {
+ db_1row get_task_values { }
+ ad_form -extend -name form_name -form { ... }
+
+
+
+
+ Troubleshooting
+ A good way to troubleshoot when you're using ad_form is to
+ add the following code at the top of the .tcl page (thanks Jerry
+ Asher):
+
+
+ns_log notice it's my page!
+set mypage [ns_getform]
+if {[string equal "" $mypage]} {
+ ns_log notice no form was submitted on my page
+} else {
+ ns_log notice the following form was submitted on my page
+ ns_set print $mypage
+}
+
+
+
Common Errors
Here are some common errors and what to do when you